-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtmux.conf
153 lines (121 loc) · 6.1 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
set -g prefix C-z
set -g default-terminal "tmux-alacritty"
set -g default-shell "/usr/bin/zsh"
set -g mouse on
set -g history-limit 32768
set -g set-titles on
set -g set-titles-string "#S / #T"
setw -g xterm-keys on # off => ^[OA, on => ^[[1;5A
setw -g automatic-rename off
setw -g aggressive-resize on
# Status bar formats
setw -g window-status-format " #T " # was: #I:#W#F
setw -g window-status-current-format " #T "
set -g status-right ""
set -g status-left "#S/#I/#(hostname -s) "
set -g status-left-length "12"
## Original theme: green bar, red current:
#setw -g window-status-current-bg colour160 # was: red
#set -g status-bg colour40 # was: green
## Another option: similar to emacs
#setw -g window-status-current-bg colour16 # black
#setw -g window-status-current-fg colour231 # white
#setw -g window-status-bell-fg colour254 # gray95
#setw -g window-status-bell-bg colour16 # black
# Status bar colors: Dark grey background, current tab light grey
# This is similar to emacs' modeline for active/inactive buffers
# Alarm tabs have slightly darker background but should prevent
# confusion with current tab, which is clearly highlighted.
set -g status-bg colour240
set -g status-fg colour250
# NOTE: these are new since 2.9 or 3.0 or something.
# previously it was `setw -g window-status-bell-bg colour250`
setw -ga window-status-bell-style bg=colour250
setw -ga window-status-bell-style fg=colour236
setw -ga window-status-current-style bg=colour252
setw -ga window-status-current-style fg=colour16
unbind C-b
bind C-z send-prefix
bind z suspend-client
bind C-r source-file ~/.tmux.conf \; display "Reloaded configuration"
bind c new-window -c '#{pane_current_path}'
# Window management
bind -n S-Left previous-window
bind -n S-Right next-window
bind -n C-S-Left swap-window -t :-1 \; previous-window
bind -n C-S-Right swap-window -t :+1 \; next-window
bind C-p swap-window -t :-1
bind C-n swap-window -t :+1
bind C-d run "tmux-detach-others #{client_name}"
bind C run "tmux-branch #{client_session}"
# TODO(sdh): consider falling back on other session in same group?
# tmux list-sessions -F '#{?#{==:#{session_group},0},#{?#{==:#{session_name},4},,#{session_name}},}' | tail
# We could possibly use an #{&&...} along with #{session_attached} to find an
# unattached session to fall back on. If none exists, then finally suicide.
bind M-d run "tmux kill-session -t #{client_session}"
bind C-k run "tmux-kill #{pane_id}"
bind M-k run "tmux-kill #{pane_id} -9"
# Use C-z C-f then C-z C-t to move a window from one session to another
bind C-f run "echo 'move-window -s #S:#I' > /tmp/tmux-move"
bind C-t source-file /tmp/tmux-move
# Shift-up/down should only enter copy mode outside emacs.
# Note: could also use #{==:+,#T} but only if we set the title correctly.
bind -n S-Up if -F "#{m:emacs*,#{pane_current_command}}" "send-keys M-[ 1 '\\;' 2 A" "copy-mode -u"
bind -n S-Down send-keys M-[ 1 '\\;' 2 B
bind -T copy-mode S-Up send-keys -X page-up
bind -T copy-mode S-Down send-keys -X page-down-and-cancel
# Likewise Shift-PgUp should not enter copy mode when in emacs
bind -n S-PgUp if -F "#{m:emacs*,#{pane_current_command}}" "send-keys M-[ 5 '\\;' 2 ~" "copy-mode -u"
bind -T copy-mode -n S-PgUp send-keys -X page-up
bind -T copy-mode -n S-PgDn send-keys -X page-down-and-cancel
bind -T copy-mode -n PgUp send-keys -X page-up
bind -T copy-mode -n PgDn send-keys -X page-down
bind -T copy-mode C-Left send-keys -X previous-word
bind -T copy-mode C-Right send-keys -X next-word-end
bind -T copy-mode M-Left send-keys -X previous-word
bind -T copy-mode M-Right send-keys -X next-word-end
bind -n WheelUpPane if -F "#{mouse_any_flag}" "send-keys -M" "if -F '#{pane_in_mode}' 'send-keys -M' 'copy-mode; send-keys -XN5 scroll-up'"
bind -T copy-mode WheelDownPane send-keys -XN5 scroll-down-and-cancel
#### Bindings we used to have but never seem to use:
# bind | pipe-pane -o 'cat >> ~/tmux-$(date +%y%m%d-%H%M%S)'
# bind C-n choose-tree "run-shell \"tmux new-session -t '%%' -s $(tmux list-sessions | wc -l)\""
# bind C-k choose-tree "kill-session -t '%%'"
# bind -n -t emacs-copy M-Space page-up
# bind -T copy-mode x copy-pipe "xclipd copy"
# TODO - what do we want to do with mouse selection?
# - would be nice if ctrl or shift did something?
# - maybe a prefix key to change mode? would be nice to have an option
# to not immediately cancel back to start, but often do want
# - typically depends on whether scrolling or not, since jump is annoying!
# - possibly just scroll-up then scroll-down-and-cancel
# - or make a plugin where entering copy-mode changes the binding
# so that it no longer cancels? (maybe a var? or query?)
# Remove "-and-cancel" since it's annoying to jump on mouse up...?
# bind -T copy-mode MouseDragEnd1Pane send-keys -X copy-pipe "xclipd copy" \; send-keys -X copy-selection \; send-keys -X scroll-up \; send-keys -X scroll-down-and-cancel
#\; send-keys -X copy-pipe "xclipd copy"
# tmux set-option -g @foo bar # allows setting arbitrary options!
# tmux show-option -gqv @foo
# NOTE: -n == -T root, -T prefix is other option?
bind -n M-MouseDown1Pane send-keys -X begin-selection \; send-keys -X rectangle-toggle
# set status-right '%H:%M '
# NOTE: we can create sequences of keys as follows:
# bind -T root m switch-client -T m-table
# bind -T m-table n next-window
# bind -T m-table p previous-window
# Use this for more complex combinations of terminal keystrokes
# -- note when cancelling, we want to re-send input...?
#bind -n M-[ switch-client -T CSI
#bind -T CSI Cancel display "Cancel M-[" \; send-keys -c M-[
#bind -T CSI '3' switch-client -T CSI3
#bind -T CSI3 Cancel display "Cancel M-[ 3" \; send-keys -c M-[ 3
#bind -T CSI3 '6' switch-client -T CSI36
#bind -T CSI36 Cancel display "Cancel M-[ 3 6" \; send-keys -c M-[ 3 6
#bind -T CSI36 '~' switch-client -T CSI36T
#bind -T CSI36T Cancel display "Cancel M-[ 3 6 ~" \; send-keys -c M-[ 3 6 ~
#bind -T CSI36T C-O display "Got C-S-O" \; switch-client -T root
#bind a switch-client -T a
#bind -T a s switch-client -T s
#bind -T a b send-keys a b c
#bind -T a Cancel send-keys -c a
#bind -T s Cancel send-keys -c a s
set set-clipboard on