-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.tmux.conf
executable file
·146 lines (111 loc) · 4.08 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
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
## Prefix
unbind C-b
set-option -g prefix M-`
bind-key M-` send-prefix
## Misc
set -g base-index 1
set -g history-limit 4096
set -g set-titles on
# tmux starts login shells by default, which causes login specific
# scripts to run everytime. this is wasteful and pollutes PATH,
# hence we override the default command to simply launch the shell
set -g default-command "exec $SHELL"
# by default escape takes a while before registering
# no idea why that makes sense, but this disables it
set -g escape-time 0
# when a window is closed and the window number is freed,
# the following windows are renumbered using this
set -g renumber-windows on
# to let vim and other apps use ctrl keys properly
set-window-option -g xterm-keys on
set -g mouse on
# see https://superuser.com/a/972232 why "alternate_on" thing is needed
bind -n WheelUpPane \
if-shell -F -t = "#{?pane_in_mode,1,#{mouse_any_flag}}" \
"send-keys -M" \
"if-shell -F -t = '#{alternate_on}'\
'send-keys Up' \
'copy-mode -e'"
# -e switch indicates copy mode should exit when scrolled to end
bind -n WheelDownPane \
if-shell -F -t = "#{?pane_in_mode,1,#{mouse_any_flag}}" \
"send-keys -M" \
"send-keys Down"
## Shortcuts
# toggle hiding the status bar, sometimes handy
bind-key Space set status
# Alt-t for horizontal split
bind-key -n M-t split-window -h -c "#{pane_current_path}"
# Alt-Shift-t for vertical split
bind-key -n M-T split-window -c "#{pane_current_path}"
# change focus with Alt-arrow_key
bind-key -n M-Up select-pane -U
bind-key -n M-Right select-pane -R
bind-key -n M-Down select-pane -D
bind-key -n M-Left select-pane -L
# move focused pane with Alt-Shift-arrow_key
bind-key -n M-S-Up swap-pane -U
bind-key -n M-S-Right swap-pane -D
bind-key -n M-S-Down swap-pane -D
bind-key -n M-S-Left swap-pane -U
# toggle fullscreen with Alt-f
bind-key -n M-f resize-pane -Z
# break to own window with Alt-b
bind-key -n M-b break-pane
# reload config with Alt-Shift-c
bind-key -n M-C source-file ~/.tmux.conf
# kill pane with Alt-Shift-q
bind-key -n M-Q kill-pane
# detach from session with Alt-d
bind-key -n M-d detach-client
# create new window with Alt-n
bind-key -n M-n new-window
# switch to nth window with Alt-n
bind-key -n M-1 select-window -t :=1
bind-key -n M-2 select-window -t :=2
bind-key -n M-3 select-window -t :=3
bind-key -n M-4 select-window -t :=4
bind-key -n M-5 select-window -t :=5
bind-key -n M-6 select-window -t :=6
bind-key -n M-7 select-window -t :=7
bind-key -n M-8 select-window -t :=8
bind-key -n M-9 select-window -t :=9
# switch to next window with Alt-Tab
bind-key -n M-Tab select-window -n
# switch to previous window with Alt-Ctrl-Tab.
# unfortunately binding Alt-Shift-Tab seems to not work
bind-key -n M-C-Tab select-window -p
# move active pane to nth window to Alt-Shift-n
bind-key -n "M-!" join-pane -t :1
bind-key -n "M-@" join-pane -t :2
bind-key -n "M-#" join-pane -t :3
bind-key -n "M-\$" join-pane -t :4
bind-key -n "M-%" join-pane -t :5
bind-key -n "M-^" join-pane -t :6
bind-key -n "M-&" join-pane -t :7
bind-key -n "M-*" join-pane -t :8
bind-key -n "M-(" join-pane -t :9
# horizontal split current window and open vim in cwd with Alt-e
bind-key -n M-e split-window -h -c '#{pane_current_path}' 'vim .'
# vertical split current window and open vim in cwd with Alt-Shift-e
bind-key -n M-E split-window -c '#{pane_current_path}' 'vim .'
## Appearance
# formats
set -g status-right '[#{session_name}] @#{host_short}'
set -g status-left ''
set -g window-status-format ' #F#I:#W ' # spaces for padding
set -g window-status-current-format ' #F#I:#W ' # spaces for padding
# positioning
set -g status-position bottom
set -g status-justify left
# colors
set -g window-status-style 'bg=colour235,fg=colour137'
set -g window-status-current-style 'bg=colour137,fg=colour235'
set -g window-status-bell-style 'bg=colour1,fg=colour255'
set -g status-style 'bg=colour235,fg=colour137'
set -g pane-border-style 'fg=colour233'
set -g pane-active-border-style 'fg=colour137'
set -g message-style 'bg=colour137,fg=colour232'
# workarounds
# XXX: st's terminfo bug, https://bugs.archlinux.org/task/57596
set -as terminal-overrides ',st*:Ss@'