Update fzf location
[dotfiles] / .tmux.conf
1 # https://leanpub.com/the-tao-of-tmux/read
2
3 # Escape codes for status bars and titles
4 # #H Hostname of local host
5 # #F Current window flag
6 # #I Current window index
7 # #P Current pane index
8 # #S Session name
9 # #T Current window title
10 # #W Current window name
11
12 # %h %d %Y - date in the [Mon DD YYYY] format
13 # %l:%M %p - time in the [HH:MM AM/PM] format
14
15
16 #------------------------------------------------------------------------------
17 # SETTINGS
18 #------------------------------------------------------------------------------
19
20 # Ensure color rendered properly?
21 set -g default-terminal "screen-256color"
22 # set -g default-terminal "tmux-256color"
23 # set -gs default-terminal xterm-256color
24
25
26
27 # Allow mouse to select windows
28 set -g mouse on
29
30 # utf8 support? seems outdated?
31 # set-window-option -g utf8 on
32
33 # for being able to send one input to all panes
34 # synchronize-panes on # off
35
36 # set the prefix to Ctrl-b
37 set -g prefix C-b
38 unbind C-a
39 bind C-b send-prefix
40
41 # Sane scrolling ???
42 # set -g terminal-overrides 'xterm*:smcup@:rmcup@'
43 #set -g terminal-overrides ",xterm-256color:Tc"
44
45 # Allow xterm titles in terminal window,
46 # terminal scrolling with scrollbar,
47 # and setting overrides of C-Up, C-Down, C-Left, C-Right
48 # set -g terminal-overrides "xterm*:XT:smcup@:rmcup@:kUP5=\eOA:kDN5=\eOB:kLFT5=\eOD:kRIT5=\eOC"
49
50
51 # update window number when one of them is deleted
52 set -g renumber-windows on
53
54 # Not renaming windows ???
55 # set -g allow-rename off
56
57 # automatic window rename on fg program change
58 set -g automatic-rename
59
60 # begin index count to 1, not 0
61 set -g base-index 1
62
63 # Set the time in milliseconds for which tmux waits after an escape is input
64 # to determine if it is part of a function or meta key sequences
65 set -s escape-time 20
66
67
68 #------------------------------------------------------------------------------
69 # STATUSBAR
70 #------------------------------------------------------------------------------
71
72 set -g status-position bottom
73 set -g status-style bg=black
74
75 set -g status-left ""
76 set -g status-right ""
77
78 # print the prefix if prefix pressed
79 set -ga status-right " #{?client_prefix, #[bright]#{prefix}#[nobright] ,}"
80
81 set -ga status-right ' #(echo \#"{last_exit_status_#{pane_id}}") '
82 #set -ga status-right ' #(cd #{pane_current_path} && sh -c "print -P %%~") '
83
84 # print the current git branch
85 # set -ga status-right '#(head="$(git -C #{pane_current_path} rev-parse --abbrev-ref HEAD 2>/dev/null)" && echo " $head ")'
86 set -ga status-right " [#H:#S] #[fg=yellow,dim] %d-%m %H:%M"
87 set -g status-right-length 200
88
89 # Left, display host and session name
90 #set -ga status-left " [#H:#S]"
91 #set -g status-left-length 50
92
93 # Window title in red if there is something
94 set -gw window-status-activity-style fg=brightred
95 set -gw window-status-bell-style fg=brightcyan
96
97 # 1 space between each window
98 set -gw window-status-separator ' '
99
100 # Inactive windows in status bar
101 set-window-option -g window-status-format '#[fg=cyan,dim]#I#[fg=blue,dim]:#[default,dim]#W'
102
103 set-window-option -g window-status-current-format '#[bg=black,fg=cyan,bold]#I#[bg=black,fg=red]:#[bg=black,fg=yellow]#W#[fg=dim]'
104
105 # put useful info in the window status bar lol
106 # set-option -g set-titles on
107 # set-option -g set-titles-string '#H:#S.#I.#P #W #T'
108
109
110 #------------------------------------------------------------------------------
111 # PANES
112 #------------------------------------------------------------------------------
113
114 # pane border style
115 set -gw pane-active-border-style fg=brightyellow
116
117 # pane border colors
118 # set -g pane-border-fg colour249
119 # set -g pane-border-bg default
120 # set -g pane-active-border-fg colour245
121 # set -g pane-active-border-bg default
122
123 # pane index starts at 1, not 0
124 set -gw pane-base-index 1
125
126 # do you want to see something pane related?
127 #set -gw pane-border-status top
128
129 # what do you want to see pane related?
130 #set -gw pane-border-format ' #{pane_current_command} '
131
132
133
134 #------------------------------------------------------------------------------
135 # BINDINGS
136 #------------------------------------------------------------------------------
137
138 # map Fns to Windows
139 bind -n F1 select-window -t :1
140 bind -n F2 select-window -t :2
141 bind -n F3 select-window -t :3
142 bind -n F4 select-window -t :4
143 # bind -n F5 select-window -t :5
144 # bind -n F6 select-window -t :6
145 # bind -n F7 select-window -t :7
146 # bind -n F8 select-window -t :8
147 # bind -n F9 select-window -t :9
148 # bind -n F10 select-window -t :10
149 # bind -n F11 select-window -t :11
150 # bind -n F12 select-window -t :12
151 # bind -n S-F1 select-window -t :13
152 # bind -n S-F2 select-window -t :14
153 # bind -n S-F3 select-window -t :15
154 # bind -n S-F4 select-window -t :16
155 # bind -n S-F5 select-window -t :17
156 # bind -n S-F6 select-window -t :18
157 # bind -n S-F7 select-window -t :19
158 # bind -n S-F8 select-window -t :20
159
160
161 # clear screen then clear history
162 # bind -n <-- means no need to send the prefix
163
164 # obsolete?
165 # bind -n C-l send-keys 'C-l'
166 # bind -n C-l send-keys C-l \; run-shell "sleep 0.3" \; clear-history
167 # Turns out hitting Ctrl+l (lowercase L) twice will clear the visible lines and then the buffer with default tmux bindings
168
169 # Intuitive splitting
170 # Split into panes, but stay in the current path
171 bind | split-window -h -c '#{pane_current_path}'
172 bind - split-window -v -c '#{pane_current_path}'
173 bind _ split-window -v -c '#{pane_current_path}'
174
175 # create new window, stay in the current path
176 bind c new-window -c '#{pane_current_path}'
177
178 # bind kill-session to C-b k
179 bind k kill-session
180
181
182 # switch panes using Alt-arrow without prefix
183 # bind M-Left select-pane -L
184 # bind M-Right select-pane -R
185 # bind M-Up select-pane -U
186 # bind M-Down select-pane -D
187
188 #------------------------------------------------------------------------------
189
190 # HOOKS
191 #------------------------------------------------------------------------------
192
193 # To refresh status bar after selecting a pane or when there is an alert
194 set-hook -g after-select-pane "refresh-client -S"
195 set-hook -g alert-activity "refresh-client -S"
196
197
198
199 #------------------------------------------------------------------------------
200 # ACTIVITY MONITORING
201 #------------------------------------------------------------------------------
202
203 # Monitor and alert whenever the output changes
204 set -gw monitor-activity on
205 set -gw activity-action none
206 set -g visual-activity on
207
208
209
210
211 #------------------------------------------------------------------------------
212 # SOME KATA
213 #------------------------------------------------------------------------------
214
215 #reload this file
216 bind F5 source-file ~/.tmux.conf \; \
217 display-message "tmux configuration reloaded!"
218
219 # launch ssh in another window
220 bind M-s command-prompt -p "ssh" "new-window -n ssh:%1 'exec ssh %1'"
221
222 # call man of command on another panel
223 bind M-m command-prompt -p "man" "split-window -h 'exec man %1'"
224
225 # open irc in another window
226 bind M-i new-window -n irc \; \
227 send-keys -t :irc 'irssi -c irc.freenode.net -n patricknsukami -w patrick/nsukami' C-m \; \
228 select-window -t :irc
229
230 # open postgresql on another window
231 bind M-p new-window -n psql \; \
232 send-keys -t :psql 'psql -U postgres -W -h localhost' C-m \; \
233 select-window -t :psql
234
235 #
236 # bind M-v new-window -n vlc -c /home/nsukami/Musique \; \
237 # send-keys -t :vlc 'vlc --intf rc playlist' C-m \; \
238 # split-window -h -t :vlc -c /home/nsukami/Musique \; \
239 # send-keys -t :vlc.1 "find . -maxdepth 1 -type f -printf '%f\n'" C-m \; \
240
241
242 # tell vlc to play something
243 bind M-v command-prompt -p "vlc " "new-window -n vlc -c /home/nsukami/Musique 'exec vlc --intf rc %1' \; \
244 split-window -h -p 30 -t :vlc -c /home/nsukami/Musique \; \
245 send-keys -t :vlc.1 'ls' C-m \; \
246 send-key -t :vlc.0 'playlist' C-m \; \
247 select-pane -t :vlc.0 \; \
248 last-window -t : "
249
250
251
252 #------------------------------------------------------------------------------
253 # OFTEN USED SESSIONS
254 #------------------------------------------------------------------------------
255
256 bind F source-file ~/.tmux/etudes.conf
257 bind G source-file ~/.tmux/events.conf
258 bind J source-file ~/.tmux/jalv2.conf
259 bind P source-file ~/.tmux/pelican.conf