-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy path.tmux.conf
120 lines (110 loc) · 4.93 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
# Environment variables
set-option -ga update-environment " PWD"
run-shell "tmux setenv -g TMUX_VERSION $(tmux -V | grep -Po '[0-9\.]*')"
# General
set-option -g default-terminal "screen-256color"
set-option -g history-limit 15000
set-option -g mode-keys vi
set-option -g set-titles on
set-option -g xterm-keys on
# Prefixes
set-option -g prefix C-a
# Window/split creation
unbind '"'
unbind %
bind-key c new-window
bind-key C-c new-window
if-shell '[ "$(echo "$TMUX_VERSION < 1.9" | bc)" = 1 ]' \
"bind-key \\ split-window -v -c '' ; \
bind-key | split-window -h -c ''"
if-shell '[ "$(echo "($TMUX_VERSION >= 1.9") && ($TMUX_VERSION < 3.0")| bc)" = 1 ]' \
"bind-key \\ split-window -v -c \"#{pane_current_path}\" ; \
bind-key | split-window -h -c \"#{pane_current_path}\""
if-shell '[ "$(echo "$TMUX_VERSION >= 3.0" | bc)" = 1 ]' \
"bind-key \\\\ split-window -v -c \"#{pane_current_path}\" ; \
bind-key | split-window -h -c \"#{pane_current_path}\""
# Navigation - windows
bind-key C-a last-window
bind-key a last-window
bind-key -r C-p previous-window
bind-key -r C-n next-window
bind-key -n S-Pageup previous-window
bind-key -n S-Pagedown next-window
bind-key -r S-Pageup swap-window -t -1
bind-key -r S-Pagedown swap-window -t +1
# Easy jump to first or last window
if-shell '[ "$(echo "($TMUX_VERSION >= 1.9") && ($TMUX_VERSION < 3.0")| bc)" = 1 ]' \
"bind-key '$' select-window -t:{end} ; \
bind-key ^ select-window -t:{start}"
if-shell '[ "$(echo "$TMUX_VERSION >= 3.0" | bc)" = 1 ]' \
"bind-key '$' select-window -t:$ ; \
bind-key ^ select-window -t:^"
# Navigation - panes
bind-key -n M-Left select-pane -L
bind-key -n M-Right select-pane -R
bind-key -n M-Up select-pane -U
bind-key -n M-Down select-pane -D
# Swap current pane up and down the pane list, allowing repetition
bind-key -r M-PageUp swap-pane -U
bind-key -r M-PageDown swap-pane -D
# Copy/paste
# Behave like vim, more or less sorta
bind-key v copy-mode
bind-key P paste-buffer
if-shell '[ "$(echo "$TMUX_VERSION < 2.4" | bc)" = 1 ]' \
"bind-key -t vi-copy v begin-selection; \
bind-key -t vi-copy C-v rectangle-toggle; \
bind-key -t vi-copy y copy-selection; \
bind-key -t vi-copy Y copy-pipe 'xclip -in -selection clipboard'"
if-shell '[ "$(echo "$TMUX_VERSION >= 2.4" | bc)" = 1 ]' \
"bind-key -T copy-mode-vi v send-keys -X begin-selection; \
bind-key -T copy-mode-vi V send-keys -X select-line; \
bind-key -T copy-mode-vi C-v send-keys -X rectangle-toggle; \
bind-key -T copy-mode-vi y send-keys -X copy-selection; \
bind-key -T copy-mode-vi Y send-keys -X copy-pipe-and-cancel 'xclip -in -selection clipboard'"
# Misc
# Reload config
bind-key r source-file "$HOME/.tmux.conf" \; display-message "Reloaded $HOME/tmux.conf"
bind-key S command-prompt -p "Keys to send to all session panes:" \
"run-shell \"$HOME/.bin/tmux-send-keys-to-all-panes %1\""
unbind =
bind-key = set-window-option synchronize-panes
# Window and pane colors
set-option -g status-bg colour32
set-option -g status-fg black
if-shell '[ "$(echo "$TMUX_VERSION < 1.9" | bc)" = 1 ]' \
"set -g pane-active-border-bg colour33; \
set -g pane-active-border-fg colour254"
if-shell '[ "$(echo "$TMUX_VERSION >= 1.9" | bc)" = 1 ]' \
"set -g pane-active-border-style 'fg=colour33,bg=colour254'"
# Nesting
# This whole rigamarole is based heavily upon the article [Nested Tmux](http://stahlke.org/dan/tmux-nested/) by Dan Stahlke.
#
# # Caveats:
#
# * The inner session by this method will not show the "nested" status bar color scheme until one hits the switch key combo for the first time.
# * bind-keys is always universal across sessions, so any sessions aside from the parent and child will get wonky in terms of keybindings.
# * The server-universality of key bindings also means nesting a tmux session on the same server will cause some issues with root-table key bindings. Namely here, the S-{Left,Right} and M-{L,R,U,D} root table bindings will turn off in the outer when shifting control to the inner, but the inner will not pick it up as they share key tables. This doesn't affect the prefix table because turn the prefix on or off as we switch nest level.
# * This method cannot handle nesting more than one layer deep.
bind -n M-F11 set-option status-bg colour81 \; set-option status-fg colour7
bind -n M-F12 set-option status-bg colour32 \; set-option status-fg black
bind -n S-Home \
send-keys M-F12 \; \
set-option status-bg colour81 \; set-option status-fg colour7 \; \
unbind -n S-Pageup \; \
unbind -n S-Pagedown \; \
unbind -n M-Left \; \
unbind -n M-Right \; \
unbind -n M-Up \; \
unbind -n M-Down \; \
set-option prefix C-b
bind -n S-End \
send-keys M-F11 \; \
set-option status-bg colour32 \; set-option status-fg black \; \
bind-key -n S-Pageup previous-window \; \
bind-key -n S-Pagedown next-window \; \
bind-key -n M-Left select-pane -L \; \
bind-key -n M-Right select-pane -R \; \
bind-key -n M-Up select-pane -U \; \
bind-key -n M-Down select-pane -D \; \
set-option prefix C-a