-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtmux.conf
139 lines (116 loc) · 5.69 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
set -g prefix C-o
set -g prefix2 None
bind o send-prefix
bind C-o last-window
bind Space next-window
bind C-Space next-window
bind D confirm-before -p "Power detach?" "detach -P"
set -g status-position top
set -g status-fg colour231
set -g status-bg colour234
set -g status-left-length 15
set -g status-left '#[fg=colour16,bg=colour254,bold]#{=5:session_name}@#{=5:host_short}#[fg=colour254,bg=colour234,nobold] '
set -g status-right '#{?client_prefix,¶, }'
set -g window-status-format "#[fg=colour244,bg=colour234]#I#[fg=colour240]#[fg=colour249]#T "
set -g window-status-current-format "#[fg=colour234,bg=colour31]#[fg=colour117,bg=colour31] #I#[fg=colour231,bold]#T #[fg=colour31,bg=colour234,nobold]"
set -ga update-environment " SSH_CLIENT SSH_CONNECTION"
set -g set-titles on
set -g set-titles-string '#S@#h:#I.#P #T'
set -ga terminal-overrides ',gnome*:XT'
set -ga terminal-overrides ',xterm-*:RGB'
set -sa terminal-features ',xterm-*:RGB'
set -g default-terminal 'screen-256color'
set-option -sg escape-time 10
if '[ -x /bin/zsh ]' 'set -g default-shell /bin/zsh'
set -g mouse on
set -g focus-events on
# *** Wheel scroll in pane WHILE in copy-mode
# Once in copy-mode, mouse wheel scrolls scrolls by half pages
bind -T copy-mode-vi WheelUpPane send -X halfpage-up
bind -T copy-mode-vi WheelDownPane send -X halfpage-down
unbind -T root WheelUpPane
unbind -T root WheelDownPane
bind -T root WheelUpPane if -Ft= '#{mouse_any_flag}' 'send-keys -M' 'if -Ft= "#{pane_in_mode}" "send-keys -M" "copy-mode -eu"'
set -g focus-events on
set -g set-clipboard on
set-window-option -g xterm-keys on
set-window-option -g mode-keys vi
set-window-option -g automatic-rename off
set-window-option -g aggressive-resize on
set-window-option -g alternate-screen off
set-window-option -g history-limit 5000
setw -g window-status-last-style underscore
set -g repeat-time 1000
bind-key Up select-pane -U
bind-key Down select-pane -D
bind-key Left select-pane -L
bind-key Right select-pane -R
bind-key k select-pane -U
bind-key j select-pane -D
bind-key h select-pane -L
bind-key l select-pane -R
# Create new windows and panes with same current directory
bind c new-window -c "#{pane_current_path}"
bind '"' split-window -c "#{pane_current_path}"
bind '|' split-window -c "#{pane_current_path}" -h
# Binding to join pane to current window
bind -T prefix a run "tmux choose-tree -Nf \"##{!=:##{pane_id},#{pane_id}}\" \"join-pane -t %%\""
# Smart pane switching with awareness of vim splits
%if "#{m/r:^2\.,#{version}}"
# For 2.x
bind -n C-h if "expr '#{pane_title}' : 'Vim@.*'" 'send-keys C-h' 'select-pane -L'
bind -n C-j if "expr '#{pane_title}' : 'Vim@.*'" 'send-keys C-j' 'select-pane -D'
bind -n C-k if "expr '#{pane_title}' : 'Vim@.*'" 'send-keys C-k' 'select-pane -U'
bind -n C-l if "expr '#{pane_title}' : 'Vim@.*'" 'send-keys C-l' 'select-pane -R'
%else
# Use more efficient conditional supported by newer versions of tmux.
bind -n C-h if -F "#{m:Vim@*,#{pane_title}}" 'send-keys C-h' 'select-pane -L'
bind -n C-j if -F "#{m:Vim@*,#{pane_title}}" 'send-keys C-j' 'select-pane -D'
bind -n C-k if -F "#{m:Vim@*,#{pane_title}}" 'send-keys C-k' 'select-pane -U'
bind -n C-l if -F "#{m:Vim@*,#{pane_title}}" 'send-keys C-l' 'select-pane -R'
%endif
# Always do navigation from copy mode
bind -T copy-mode-vi C-h select-pane -L
bind -T copy-mode-vi C-j select-pane -D
bind -T copy-mode-vi C-k select-pane -U
bind -T copy-mode-vi C-l select-pane -R
# If navigation keys are used with prefix, pass them through for use by enclosed program
bind -T prefix C-h send C-h
bind -T prefix C-j send C-j
bind -T prefix C-k send C-k
bind -T prefix C-l send C-l
bind C-l send-keys 'C-l'
bind -T prefix a swap-pane
# Add non-breaking space to word-separators
set -a -g word-separators
%if "#{m/r:^2\.,#{version}}"
# Do nothing
%else
# Search back to last prompt
bind-key -T prefix p { copy-mode; send-keys p }
bind-key -T copy-mode-vi p { send-keys -X start-of-line; send-keys -X search-backward " "; send-keys -X next-word }
%endif
# Use my `clipboard` (AKA `clip`) command for copy and paste
bind -T copy-mode-vi Enter send -X copy-pipe-and-cancel "clipboard copy"
bind ']' run "clipboard paste | tmux load-buffer - && tmux paste-buffer"
bind -T copy-mode-vi MouseUp1Pane send -X copy-pipe "clipboard copy"
# `y` in copy mode should copy the selection, but not exit
bind -T copy-mode-vi 'y' send -X 'copy-selection'
# Allow using prefix in copy mode
bind -T copy-mode '^o' switch-client -T prefix
# Set pane border format for when there are multiple panes
setw -g pane-border-format ' #{pane_title} '
# Use color and arrows to indicate active pane
setw -g pane-border-indicators both
# Auto hide pane-border-status line when only one pane is displayed (see tmux/tmux#566)
set-hook -g 'after-new-window' 'run-shell -b "if [ \#{window_panes} -eq 1 ]; then tmux set pane-border-status off; fi"'
set-hook -g 'after-kill-pane' 'run-shell -b "if [ \#{window_panes} -eq 1 ]; then tmux set pane-border-status off; fi"'
set-hook -g 'pane-exited' 'run-shell -b "if [ \#{window_panes} -eq 1 ]; then tmux set pane-border-status off; fi"'
set-hook -g 'after-split-window' 'run-shell -b "if [ \#{window_panes} -gt 1 ]; then tmux set pane-border-status top; fi"'
# Easy killing or respawning of dead panes
bind -T root x if -F '#{pane_dead}' { kill-pane } { send-keys x }
bind -T root X if -F '#{pane_dead}' { kill-pane } { send-keys X }
bind -T root C-X if -F '#{pane_dead}' { kill-pane } { send-keys C-X }
bind -T root R if -F '#{pane_dead}' { respawn-pane } { send-keys R }
set -g remain-on-exit-format '(R)espawn or e(X)it. Died with #{?pane_dead_signal,signal #{pane_dead_signal},status #{pane_dead_status}} at #{t:pane_dead_time}'
#new-session -s dflt