-
Notifications
You must be signed in to change notification settings - Fork 43
/
.tmux.conf
156 lines (132 loc) · 5.49 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
147
148
149
150
151
152
153
154
155
156
if 'uname -s | grep -q Darwin' \
'set -g default-terminal "screen-16color"' \
'set -g default-terminal "tmux-256color"'
### Screen-like keybindings.
unbind C-b
set -g prefix C-a
bind C-a send-prefix
bind a send-prefix
bind A command-prompt "rename-window %%"
setw -g automatic-rename off
set -g mouse off
bind Escape copy-mode
# Default is too slow which is annoying during heavy-use of the copy buffer
set -s escape-time 100
set -g display-time 1500
# vi-keys everywhere; anything else would be uncivilized.
setw -g mode-keys vi
set -g status-keys vi
setw -g xterm-keys on
# Move between windows/panes.
bind C-a last-window
bind " " next-window
bind BSpace previous-window
bind '"' choose-tree
bind h select-pane -L
bind j select-pane -D
bind k select-pane -U
bind l select-pane -R
bind H command-prompt -p \
"Change width to lines (current #{pane_width}):" "resize-pane -x %1"
bind J command-prompt -p \
"Change height to lines (current #{pane_height}):" "resize-pane -y %1"
bind K command-prompt -p \
"Change height to lines (current #{pane_height}):" "resize-pane -y %1"
bind L command-prompt -p \
"Change width to lines (current #{pane_width}):" "resize-pane -x %1"
bind s command-prompt -p "Swap pane with target:" "swap-pane -t %1"
bind S command-prompt -p "Swap window with target:" "swap-window -t %1"
bind n movew -r\; display "Windows renumbered."
bind N command-prompt -p "Choose new (unused) window number:" "move-window -t %1"
# Splits (horizontal & vertical, split current pane or full window)
bind | split-window -h -c "#{pane_current_path}"
bind "\\" split-window -b -h -f -c "#{pane_current_path}"
bind - split-window -v -c "#{pane_current_path}"
bind _ split-window -b -v -f -c "#{pane_current_path}"
bind r next-layout
bind R previous-layout
bind T command-prompt -p "Select layout (main|even|tiled)-(hor|vert):" "select-layout %%"
bind p command-prompt -p "put pane into:" "join-pane -t '%%'"
bind P command-prompt -p "pull pane from:" "join-pane -s '%%'"
bind C new-window -c "#{pane_current_path}"
bind y set -w synchronize-panes\; \
display "panes synchronized: #{?pane_synchronized,ON,OFF}"
bind Y set -w remain-on-exit\; \
display "panes remain on exit: #{?remain-on-exit,ON,OFF}"
bind X confirm-before -p "Kill window?" "kill-window"
bind Z confirm-before -p "Kill all zombie (dead) panes?" \
"run \"tmux list-panes -F '##{pane_id} ##{pane_dead}' \
| awk '$2 == 1 { print $1 }' \
| xargs -r -n1 tmux kill-pane -t\""
# Re-blank the pane title.
# Useful if an ssh session has set it but you've since logged out.
bind I select-pane -T "" \; display "Title reset."
# Nice, big scrollback buffer (lines).
set -g history-limit 100000
bind C-l clear-history\; display "History cleared."
# Read and write and delete paste buffer.
bind > choose-buffer \
'run "tmux save-buffer -b %% - | xclip -i -select clipboard > /dev/null"'
bind < run 'xclip -o -selection clipboard | tmux load-buffer -'
bind + choose-buffer 'delete-buffer -b %%'
# Allow interop with system clipboard.
set -s set-clipboard on
# Toggle activity/silence monitoring.
bind m setw monitor-activity\; display \
"Watching for activity: #{?monitor-activity,ON,OFF}"
bind M command-prompt -p \
"Watching for silence (0 disables; current: #{monitor-silence}):" \
"setw monitor-silence %%"
# Toggle tmux prefix key on and off.
bind -T root F12 set prefix None\; set key-table off
bind -T off F12 set -u prefix\; set -u key-table
# Set xterm window status.
set-option -g set-titles on
set-option -g set-titles-string '#H ###I.#P #W (#S)'
set-option -g allow-rename off
# Create custom aliases.
# These can be run via the command prompt (`:`) or bound to a key.
set -s command-alias[1001] std-term-size="resize-pane -x 80 -y 24"
set -s command-alias[1002] work-window="run 'tmux renamew work; \
tmux splitw -l 3 -c \"#{pane_current_path}\"; \
tmux selectp -U'"
### Colors.
set -g status-style "fg=white,bg=black"
set -g message-style "fg=black,bg=green"
setw -g window-status-bell-style "fg=black,bg=green,blink"
setw -g window-status-current-style "fg=blue,bg=white,dim"
set -g pane-border-status top
# xquartz has some performance issues. When dimming inactive panes xquartz will
# trigger redraws in all panes (oddly, this doesn't happen when adding/removing
# the * marker). With multiple open Vim sessions the redraw is very slow and
# lags input until complete.
if 'uname -s | grep -q Darwin' \
'set -g pane-border-style "fg=terminal,bg=terminal"; \
set -g pane-active-border-style "fg=terminal,bg=terminal"' \
'set -g pane-border-style "fg=terminal,bg=terminal,dim"; \
set -g pane-active-border-style "fg=terminal,bg=terminal,bright"'
# Show window flags to the left of the window name & number.
set -g window-status-format '#{?window_flags,#{window_flags}:, }#I #W'
set -g window-status-current-format '#{E:window-status-format}'
# Show pwd, git, and tmux pane info in pane title.
# (Hides the default hostname #{pane_title}.)
set -g pane-border-format "\
#[fg=terminal] \
#{?pane_active,*,} \
#{?#(test -w \"#{pane_current_path}\" && echo 1),#[fg=green],#[fg=yellow]}\
#{?#{==:#{pane_current_path},$HOME},~,#{b:pane_current_path}}\
#[fg=terminal] \
#(~/bin/git-prompt -c tmux '#{pane_current_path}' && tmux refresh -S)\
#[align=right] \
#{pane_id} \
#{pane_index}\
#{?#{==:#{host},#{pane_title}},, #{pane_title}} \
"
### Status bar.
set -g status-right-length 50
set -g status-right "\
#{?#{==:#{prefix},None},#[fg=red]!PREFIX#[fg=default] ,}\
#[fg=yellow]%H:%M \
#[fg=default]%F \
#[fg=cyan]#h"
# vim:ft=tmux