-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtmux.conf
More file actions
177 lines (134 loc) · 5.7 KB
/
tmux.conf
File metadata and controls
177 lines (134 loc) · 5.7 KB
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
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
# set -g default-shell $SHELL
# improve colors
set -g default-terminal "xterm-256color"
#set -ga terminal-overrides ",*256col*:Tc"
# set -ga terminal-overrides ",xterm-256color:Tc"
set -ga terminal-overrides ",xterm*:Tc:smcup@:rmcup@"
set -ga terminal-overrides ",screen*:Tc:smcup@:rmcup@"
set -ga terminal-overrides ",tmux*:Tc:smcup@:rmcup@"
# set -g terminal-overrides "xterm*:XT:smcup@:rmcup@:kUP5=\eOA:kDN5=\eOB:kLFT5=\eOD:kRIT5=\eOC"
# set -gw xterm-keys on
set -g focus-events on
set -g repeat-time 0
set -g base-index 1
setw -g pane-base-index 1
set -g renumber-windows on
set -g display-panes-time 1000
# Keep plenty of history for scrollback
set -g history-limit 64096
# Use emacs / readline key-bindings at the tmux command prompt `<prefix>:`
set -g status-keys emacs
# address vim mode switching delay (http://superuser.com/a/252717/65504)
set -sg escape-time 0
# set -sg escape-time 10
set -g mouse on
#### Key bindings
setw -g mode-keys vi
# Ctrl-s prefix key. Default => C-b. Send C-s with repeat option via C-s C-s
unbind C-b
set -g prefix C-s
bind -r C-s send-prefix
# more intuitive keybindings for splitting
bind \\ split-window -h -c "#{pane_current_path}"
bind - split-window -v -c "#{pane_current_path}"
# Use vim keybindings in copy mode
bind -T copy-mode-vi v send -X begin-selection
bind -T copy-mode-vi y send -X copy-pipe-and-cancel "pbcopy"
unbind -T copy-mode-vi Enter
bind -T copy-mode-vi Enter send -X copy-pipe-and-cancel "pbcopy"
unbind -T copy-mode-vi Space
bind -T copy-mode-vi Space send -X jump-again
bind -T copy-mode-vi 0 send -X back-to-indentation
bind y run "tmux save-buffer - | pbcopy "
bind C-y run "tmux save-buffer - | pbcopy "
# Default to incremental search in copy-mode
bind -T copy-mode-vi / command-prompt -i -p "search down" "send -X search-forward-incremental \"%%%\""
bind -T copy-mode-vi ? command-prompt -i -p "search up" "send -X search-backward-incremental "%%%""
bind / copy-mode\; command-prompt -i -p "search up" "send -X search-backward-incremental "%%%""
# Dismiss current pane to background window
bind b break-pane -d
# Start new session in current directory
bind C-b send-keys "tat && exit" "C-m"
# kill session and switch to next
bind ! run-shell "(tmux switch-client -l || tmux switch-client -n) && tmux kill-session -t '#S' || tmux kill-session"
#
bind j command-prompt -p "join pane from: " "join-pane -h -s '%%'"
# Kill all panes except current
bind -r e kill-pane -a
# Easily swap a pane (targeted by pane number) with the current pane
bind s command-prompt -p "pane #: " "swap-pane -t '%%'"
# bind t split-window -h -c "#{pane_current_path}" "source ~/.config/fish/navigation.zsh && itree | less -R"
# Fzf for opened sessions
bind C-o run-shell "tmux-popup 'tmux-open-session' 40"
bind C-i run-shell "tmux-popup 'tmux-switch-session' 40"
#
bind p run-shell "tmux-popup"
# Open urls in the current pane
bind u capture-pane -J \; \
save-buffer "/tmp/tmux-buffer" \; \
delete-buffer \; \
display-popup -E -h '80%' "egrep -o 'https?://[^ ]+' /tmp/tmux-buffer | fzf --select-1 | xargs open"
# Reload settings
bind r source-file ~/.tmux.conf \; display "Reloaded!"
# Open current directory
bind o run-shell "open #{pane_current_path}"
# Smart pane switching with awareness of Vim splits.
# See: https://github.com/christoomey/vim-tmux-navigator
is_vim="ps -o state= -o comm= -t '#{pane_tty}' \
| grep -iqE '^[^TXZ ]+ +(\\S+\\/)?g?(view|n?vim?x?)(diff)?$'"
bind-key -n 'C-h' if-shell "$is_vim" 'send-keys C-h' 'select-pane -L'
bind-key -n 'C-j' if-shell "$is_vim" 'send-keys C-j' 'select-pane -D'
bind-key -n 'C-k' if-shell "$is_vim" 'send-keys C-k' 'select-pane -U'
bind-key -n 'C-l' if-shell "$is_vim" 'send-keys C-l' 'select-pane -R'
tmux_version='$(tmux -V | sed -En "s/^tmux ([0-9]+(.[0-9]+)?).*/\1/p")'
if-shell -b '[ "$(echo "$tmux_version < 3.0" | bc)" = 1 ]' \
"bind-key -n 'C-\\' if-shell \"$is_vim\" 'send-keys C-\\' 'select-pane -l'"
if-shell -b '[ "$(echo "$tmux_version >= 3.0" | bc)" = 1 ]' \
"bind-key -n 'C-\\' if-shell \"$is_vim\" 'send-keys C-\\\\' 'select-pane -l'"
bind-key -T copy-mode-vi 'C-h' select-pane -L
bind-key -T copy-mode-vi 'C-j' select-pane -D
bind-key -T copy-mode-vi 'C-k' select-pane -U
bind-key -T copy-mode-vi 'C-l' select-pane -R
bind-key -T copy-mode-vi 'C-\' select-pane -l
# Resizing pane
bind -r C-k resize-pane -U 5
bind -r C-j resize-pane -D 5
bind -r C-h resize-pane -L 5
bind -r C-l resize-pane -R 5
# Moving window in status bar (fn+option+arrow)
bind -n M-Home swap-window -t -1 \; previous-window
bind -n M-End swap-window -t +1 \; next-window
# Shift arrow to switch windows
bind -n M-Tab next-window
bind -n C-End previous-window # M-BTab binded in iterm prefs
bind -n M-w kill-window
bind -n M-t new-window -c "#{pane_current_path}"
bind "'" last-window
bind -n M-0 select-window -t 0
bind -n M-1 select-window -t 1
bind -n M-2 select-window -t 2
bind -n M-3 select-window -t 3
bind -n M-4 select-window -t 4
bind -n M-5 select-window -t 5
bind -n M-6 select-window -t 6
bind -n M-7 select-window -t 7
bind -n M-8 select-window -t 8
bind -n M-9 select-window -t 9
# allow the title bar to adapt to whatever host you connect to
set -g set-titles on
set -g set-titles-string "#T"
set -g status-left-length 85
set -g status-right-length 85
# Plugins
set -g @plugin "am1re/everforest-tmux"
set -g @plugin "tmux-plugins/tmux-prefix-highlight"
set -g @prefix_highlight_show_copy_mode 'on'
set -g @prefix_highlight_show_sync_mode 'on'
set -g @prefix_highlight_prefix_prompt '💤'
set -g @prefix_highlight_copy_prompt 'Copy'
set -g @prefix_highlight_sync_prompt 'Sync'
set -g @nord_tmux_date_format "%d.%m"
set -g @nord_tmux_no_patched_font 0
run "~/.tmux/plugins/tpm/tpm"
# Import
if-shell "uname -s | grep -q Darwin" "source ~/.tmux.conf.osx"