-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathtmux.conf
More file actions
163 lines (123 loc) · 4.73 KB
/
tmux.conf
File metadata and controls
163 lines (123 loc) · 4.73 KB
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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
# start non-login shell (there's no zprofile)
set -g default-command $SHELL
# start numbering at 1
set-option -g base-index 1
# create a default session on server start
new-session
set -g prefix C-s
unbind C-b
bind C-s send-prefix
# update env
set -g update-environment -r
# Add dim color support
set -sa terminal-overrides ",*:dim=\\E[2m"
# Clear buffer
bind C-l send-keys C-l \; clear-history
# support for 256 colors
set-option -g default-terminal "xterm-256color"
# make pbcopy & pbpaste to work in OS X
if-shell 'test "$(uname)" = "Darwin"' \
'set-option -g default-command "tmux rename-window shell; reattach-to-user-namespace -l $SHELL"'
# bind vi key-mapping
set-option -g status-keys vi
# vi-style controls for copy mode
set-window-option -g mode-keys vi
# large history
set-option -g history-limit 100000
# highlight status bar on activity
set-window-option -g monitor-activity off
set-option -g visual-activity on
set-option -g visual-bell off
# automatically set window title
set-window-option -g automatic-rename on
set-option -g set-titles on
set-option -g set-titles-string "#T"
# force a reload of the config file
bind r source-file ~/.tmux.conf
# default statusbar colors
set-option -g status-style fg=colour244,bg=colour234
# default window title colors
set-window-option -g window-status-style fg=colour244,bg=default,dim
# active window title colors
set-window-option -g window-status-current-style fg=colour254,bg=default,none
# activity window colors
set-window-option -g window-status-activity-style bg=default
# pane border
set-option -g pane-border-style fg=colour235
set-option -g pane-active-border-style fg=colour240
# message text
set-option -g message-style fg=colour7,bg=colour235
# pane number display
set-option -g display-panes-active-colour colour4
set-option -g display-panes-colour colour7
# clock
set-window-option -g clock-mode-colour colour214
# splitting windows into panes with h and v
bind-key h split-window -v -c "#{pane_current_path}"
bind-key v split-window -h -c "#{pane_current_path}"
# create new window with the current directory
bind-key c new-window -c "#{pane_current_path}"
# set up resize-pane keys
bind-key -r > resize-pane -R 3
bind-key -r < resize-pane -L 3
bind-key -r - resize-pane -D 1
bind-key -r = resize-pane -U 1
# shift + arrows to switch windows (w/o prefix key)
bind -n S-Left previous-window
bind -n S-Right next-window
# set up swap-pane keys
bind-key [ swap-pane -U
bind-key ] swap-pane -D
# mouse mode
set -g mouse on
# report focus events
set -g focus-events on
# remove time and hostname in status bar
set-option -g status-left '#S '
set-option -g status-right ''
# set up copy and paste keys
unbind [
bind Escape copy-mode
unbind p
bind p paste-buffer
bind-key -T copy-mode-vi 'v' send -X begin-selection
bind-key -T copy-mode-vi 'V' send -X select-line
bind-key -T copy-mode-vi 'r' send -X rectangle-toggle
bind-key -T copy-mode-vi 'y' send -X copy-selection
# choose buffer to paste interactively
# bind-key o choose-buffer
# delete the most recently copied buffer of text
# bind-key x delete-buffer
# toggle statusbar
bind-key b set status
# disable delay between characters in commands
set-option -s escape-time 0
# load "SSH" overrides
if-shell '[ -n "$SSH_TTY" ]' 'source $DOTFILES_PATH/tmux-ssh.conf'
# load local overrides
if-shell "test -f ~/.tmux.local.conf" "source-file ~/.tmux.local.conf"
set-option -g @resurrect-save 'S'
set-option -g @resurrect-restore 'R'
# 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|l?n?vim?x?|fzf)(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
# }}}
run-shell "$DOTFILES_PATH/tmux/plugins/resurrect/resurrect.tmux"
run-shell "$DOTFILES_PATH/tmux/plugins/open/open.tmux"
run-shell "$DOTFILES_PATH/tmux/plugins/copycat/copycat.tmux"
run-shell "$DOTFILES_PATH/tmux/plugins/yank/yank.tmux"