-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.tmux.conf
executable file
·99 lines (82 loc) · 3.95 KB
/
.tmux.conf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
# Plugins
set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'tmux-plugins/tmux-sensible'
set -g @plugin 'seebi/tmux-colors-solarized' # Theme
set -g @plugin 'tmux-plugins/tmux-resurrect' # Restore environment on restart
set -g @plugin 'tmux-plugins/tmux-continuum' # Automatically save environment
set -g @plugin 'tmux-plugins/tmux-sessionist' # Manipulate tmux sessions
set -g @plugin 'tmux-plugins/tmux-yank' # Copy text from terminal to clipboard
set -g @plugin 'tmux-plugins/tmux-copycat'
set-option -g prefix C-Space
unbind-key C-b
bind-key Space send-prefix
set -g default-terminal 'screen-256color' # Improve colors
set -g @colors-solarized 'dark' # Tmux theme
set -g @continuum-restore 'on' # Restore previous session when tmux starts
set -g history-limit 100000 # Increase scrollback buffer size
set -g focus-events on # Focus events enabled for terminals that support them
set -g mouse on # Activate mouse mode in tmux
set -g renumber-windows on # Renumber windows sequentially after closing any of them
set -g @resurrect-capture-pane-contents 'on' # Restore pane contents
set -g @resurrect-strategy-vim 'session' # Save vim sessions using tpose's obsession
set -sg escape-time 0
set-option -g terminal-overrides 'xterm*:smcup@:rmcup@' # Allow terminal scrolling
set-option -g allow-rename off # Don't rename windows automatically
# Start windows and panes at 1, not 0
set -g base-index 1
set -g pane-base-index 1
# Alert when something happened in another window
setw -g monitor-activity on
set -g visual-activity on
# Vim visual selection and yank when in copy mode
bind Space copy-mode
bind C-Space copy-mode
bind-key -Tcopy-mode-vi 'v' send -X begin-selection
bind-key -Tcopy-mode-vi 'y' send -X copy-pipe-and-cancel "xclip -i -sel c"
# After we have something yanked back in Vim we can paste our yanked selection
# anywhere we are in insert mode with (prefix p). This works in the vim buffer,
# search and fuzzy finder buffer for example
bind p paste-buffer
# Set vim mode keybindings
set-window-option -g mode-keys vi
setw -g mode-keys vi
set -g status-keys vi
# Restore all opened programs in tmux
# disabled because it's dangerous, TODO: allow only rails processes besides vim
set -g @resurrect-processes ':all:'
#### Statusbar ####
set -g status-interval 1
set -g status-justify centre # Centre align window list
set -g status-left '#[fg=blue] #H #[default]'
set -g status-right "#[fg=blue]#S #I:#P"
set -a status-style 'bg=#666666,hidden'
set -a status-style 'fg=#FAFAFA,default'
set -g window-status-format '#[fg=blue] #I:#W#F'
set -g window-status-current-format '#I:#W#F'
setw -g window-status-activity-style 'fg=blue,bold'
#### Keybinds ####
bind-key o attach-session -t console
bind-key r attach-session -t projects
# Smart pane switching with awareness of Vim splits.
# See: https://github.com/christoomey/vim-tmux-navigator
is_vim="ps -o state= -o comm= -t '#{pane_tty}' \
| grep -iqE '^[^TXZ ]+ +(\\S+\\/)?g?(view|n?vim?x?)(diff)?$'"
bind-key -n 'C-h' if-shell "$is_vim" 'send-keys C-h' 'select-pane -L'
bind-key -n 'C-j' if-shell "$is_vim" 'send-keys C-j' 'select-pane -D'
bind-key -n 'C-k' if-shell "$is_vim" 'send-keys C-k' 'select-pane -U'
bind-key -n 'C-l' if-shell "$is_vim" 'send-keys C-l' 'select-pane -R'
tmux_version='$(tmux -V | sed -En "s/^tmux ([0-9]+(.[0-9]+)?).*/\1/p")'
if-shell -b '[ "$(echo "$tmux_version < 3.0" | bc)" = 1 ]' \
"bind-key -n 'C-\\' if-shell \"$is_vim\" 'send-keys C-\\' 'select-pane -l'"
if-shell -b '[ "$(echo "$tmux_version >= 3.0" | bc)" = 1 ]' \
"bind-key -n 'C-\\' if-shell \"$is_vim\" 'send-keys C-\\\\' 'select-pane -l'"
bind-key -T copy-mode-vi 'C-h' select-pane -L
bind-key -T copy-mode-vi 'C-j' select-pane -D
bind-key -T copy-mode-vi 'C-k' select-pane -U
bind-key -T copy-mode-vi 'C-l' select-pane -R
bind-key -T copy-mode-vi 'C-\' select-pane -l
# Use ZSH
set -g default-shell /bin/zsh
# Reload config without killing tmux server
bind R source-file ~/.tmux.conf \; display-message " Config reloaded..."
run '~/.tmux/plugins/tpm/tpm'