-
Notifications
You must be signed in to change notification settings - Fork 4
/
tmux.conf
138 lines (113 loc) · 5.76 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
set -g prefix C-s
set -g base-index 1
set -g renumber-windows on
set -g mode-keys vi
set -g escape-time 0
set -g xterm-keys on
set -g mouse on
set -g status-interval 1
set -g default-terminal "tmux-256color"
set -g default-command "~/.scripts/tmux/shell"
set -g history-limit 10000
set -g focus-events on
set -as terminal-overrides ',*:Smulx=\E[4::%p1%dm' # undercurl support
set -as terminal-overrides ',*:Setulc=\E[58::2::%p1%{65536}%/%d::%p1%{256}%/%{255}%&%d::%p1%{255}%&%d%;m' # underline colours
unbind-key %
bind-key | split-window -h
bind-key - split-window -v
bind-key C-s send-prefix
bind-key C-d copy-mode
bind-key C-a select-pane -t :.+
bind-key . split-window -v -l 4 -c "#{pane_current_path}"
bind-key u run-shell "~/.scripts/tmux/scrollback"
bind-key Space command-prompt
bind-key - split-window -c "#{pane_current_path}"
bind-key -r "<" swap-window -d -t -1
bind-key -r ">" swap-window -d -t +1
bind-key -T copy-mode-vi MouseDragEnd1Pane if-shell -F '#{scroll_position}' "send-keys -X copy-selection" "send-keys -X copy-selection-and-cancel"
bind-key -T copy-mode-vi NPage send-keys -X page-down \; if-shell -F '#{scroll_position}' "" "send-keys -X cancel"
bind-key h split-window "zsh -i -c '~/.scripts/keymaps =(bindkey -L) 1'" \; resize-pane -Z
bind-key C-q kill-session
bind-key x kill-pane
unbind-key M-1
unbind-key M-2
unbind-key M-3
unbind-key M-4
unbind-key M-5
unbind-key M-6
unbind-key M-7
unbind-key M-8
unbind-key M-9
unbind-key M-0
unbind-key M-n
unbind-key M-o
unbind-key M-p
bind-key -n M-1 run-shell "~/.scripts/tmux/switch-tab --determine '#{pane_current_command}' '#{window_name}' '#{@tab-escape}' 1"
bind-key -n M-2 run-shell "~/.scripts/tmux/switch-tab --determine '#{pane_current_command}' '#{window_name}' '#{@tab-escape}' 2"
bind-key -n M-3 run-shell "~/.scripts/tmux/switch-tab --determine '#{pane_current_command}' '#{window_name}' '#{@tab-escape}' 3"
bind-key -n M-4 run-shell "~/.scripts/tmux/switch-tab --determine '#{pane_current_command}' '#{window_name}' '#{@tab-escape}' 4"
bind-key -n M-5 run-shell "~/.scripts/tmux/switch-tab --determine '#{pane_current_command}' '#{window_name}' '#{@tab-escape}' 5"
bind-key -n M-6 run-shell "~/.scripts/tmux/switch-tab --determine '#{pane_current_command}' '#{window_name}' '#{@tab-escape}' 6"
bind-key -n M-7 run-shell "~/.scripts/tmux/switch-tab --determine '#{pane_current_command}' '#{window_name}' '#{@tab-escape}' 7"
bind-key -n M-8 run-shell "~/.scripts/tmux/switch-tab --determine '#{pane_current_command}' '#{window_name}' '#{@tab-escape}' 8"
bind-key -n M-9 run-shell "~/.scripts/tmux/switch-tab --determine '#{pane_current_command}' '#{window_name}' '#{@tab-escape}' 9"
bind-key -n M-` run-shell "~/.scripts/tmux/switch-tab --escape-next"
bind-key -n M-~ run-shell "~/.scripts/tmux/switch-tab --escape-next"
bind-key -n M-c run-shell "~/.scripts/tmux/copy #{pane_current_command} '#{window_name}'"
bind-key -n M-v run-shell "~/.scripts/tmux/paste #{pane_current_command} '#{window_name}'"
bind-key -n M-o run-shell 'MUX_SESSION=$TMUX_MUX_SESSION MUX_CONFIG=$TMUX_MUX_CONFIG mux menu'
bind-key C-h run-shell "~/.scripts/tmux/cheat --run-popup #{pane_current_command}"
bind-key C-j display-popup -w 78 -E "~/.scripts/tmux/browse-sessions"
bind-key o run-shell "~/.scripts/tmux/open-urls"
bind-key -n C-MouseDown3Pane display-menu -T "#[align=center]#{pane_index} (#{pane_id})" -t = -x M -y M \
"#{?pane_pipe,Restalk,Stalk}" "s" "pipe-pane '~/.scripts/mire stalk'" \
"#{?pane_pipe,Unstalk,}" "" "pipe-pane"
bind-key -n M-MouseDown3Status display-menu -T "#[align=centre]#{window_index}:#{window_name}" -t = -x W -y W \
"#{?#{>:#{session_windows},1},,-}Swap Left" l "swap-window -t:-1" \
"#{?#{>:#{session_windows},1},,-}Swap Right" r "swap-window -t:+1" \
"#{?pane_marked_set,,-}Swap Marked" s swap-window \
'' \
Kill X kill-window \
Respawn R "respawn-window -k" \
"#{?pane_marked,Unmark,Mark}" m "select-pane -m" \
Rename n "command-prompt -I \"#W\" \"rename-window -- '%%'\"" \
'' \
"New After" w "new-window -a" \
"New At End" W new-window
bind-key -n M-MouseDown3StatusLeft display-menu -T "#[align=centre]#{session_name}" -t = -x M -y W \
Next n "switch-client -n" \
Previous p "switch-client -p" \
'' \
Renumber N "move-window -r" \
Rename n "command-prompt -I \"#S\" \"rename-session -- '%%'\"" \
'' \
"New Session" s new-session \
"New Window" w new-window
# Colors
set -g status-fg white
set -g status-bg colour234
# Custom status bar
set -g status-left-length 32
set -g status-right-length 150
set -g status-interval 5
# Theme
set -g status-left "\
#[fg=colour235,bg=colour252,bold] ❐ #{=/17/…:session_name} \
#[fg=colour245,bg=colour238,bold] #(whoami) \
#[fg=colour238,bg=colour234,nobold]"
set -g status-right '\
#{?@info,#(tmux show -v @info) ,}\
#[fg=colour245,bg=colour238] #(~/.scripts/tmux/fragment #{pane_current_command}) \
#[fg=colour231,bg=colour88]#{?@warn, #(tmux show -v @warn) ,}\
#[fg=colour235,bg=colour245,bold]#(~/.scripts/tmux/battery)\
#[fg=colour235,bg=colour252,bold] #(date +%H:%M) #[fg=colour235,bg=colour252,bold]'
set -g window-status-format "#[fg=white,bg=colour234] #{?window_zoomed_flag,🔍 ,#{?pane_pipe,#[fg=colour15]#I#[fg=white],#I}} #W "
set -g window-status-current-format "#[fg=colour25,bg=colour39,noreverse,bold] #{?window_zoomed_flag,🔍 ,#{?pane_pipe,#[fg=colour15]#I#[fg=colour25],#I}} #W "
if-shell -F $WT_SESSION "set -g escape-time 20"
# TODO Some default overrides for macs. I'm unsure they should be here at all
set -g default-terminal "screen-256color"
set -as terminal-overrides ',xterm-256color:RGB' # true color
set -as terminal-overrides ',*:Smulx=\E[4::%p1%dm' # undercurl support
set -as terminal-overrides ',*:Setulc=\E[58::2::%p1%{65536}%/%d::%p1%{256}%/%{255}%&%d::%p1%{255}%&%d%;m' # underline colours
# Local options
source-file -q ~/.tmux.conf.local