-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathtmux.conf
116 lines (89 loc) · 3.2 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
# Remap prefix to C-q.
set -g prefix C-q
unbind C-b
bind-key C-q send-keys C-q
# Status bar at top.
set-option -g status-position top
set -g status-right '#{battery_status_bg} #{battery_icon} #{battery_percentage} #{battery_remain} | %a %d/%m %H:%M '
# Index from 1.
set -g base-index 1
set -g pane-base-index 1
# Renumber other windows when one closes.
set-option -g renumber-windows on
# Use Vi-style bindings in copy mode.
set-window-option -g mode-keys vi
# <prefix>v to start selecting in copy mode
bind-key -T copy-mode-vi v send-keys -X begin-selection
# y to copy selection to clipboard in copy mode.
bind-key -T copy-mode-vi y send-keys -X copy-pipe-and-cancel 'xclip -in -selection clipboard'
# p to paste from clipboard.
unbind p
bind p paste-buffer
# Prefix h/v for opening vertical/horizontal splits, and open these relative to
# current pane's working directory.
bind-key h split-window -v -c "#{pane_current_path}"
bind-key v split-window -h -c "#{pane_current_path}"
# Open new windows relative to current pane's working directory also.
bind c new-window -c "#{pane_current_path}"
# Don't rename windows with running program.
set-option -g allow-rename off
# Clear screen with <prefix>C-l - sends prefix if in Vim so it can handle this
# appropriately (`is_vim` definition stolen from
# https://github.com/christoomey/vim-tmux-navigator/blob/9f7d1588b04644d8a1671d2325fefbb4f772e466/vim-tmux-navigator.tmux#L3,L4).
is_vim="ps -o state= -o comm= -t '#{pane_tty}' \
| grep -iqE '^[^TXZ ]+ +(\\S+\\/)?g?(view|n?vim?x?)(diff)?$'"
bind C-l if-shell "$is_vim" "send-keys C-q" "send-keys C-l"
# Cycle pane around window.
bind C swap-pane -U
# Unbind <prefix>C-z to suspend whole Tmux session; no use for this when there
# is no shell behind Tmux (see https://unix.stackexchange.com/a/285351/229081).
unbind C-z
# Unbind various bindings to switch layout to avoid accidentally hitting.
unbind space
unbind M-1
unbind M-2
unbind M-3
unbind M-4
unbind M-5
# F1-10 to select windows 1-10.
bind -n F1 select-window -t 1
bind -n F2 select-window -t 2
bind -n F3 select-window -t 3
bind -n F4 select-window -t 4
bind -n F5 select-window -t 5
bind -n F6 select-window -t 6
bind -n F7 select-window -t 7
bind -n F8 select-window -t 8
bind -n F9 select-window -t 9
bind -n F10 select-window -t 10
# And <prefix>F1-10 to access actual function keys.
bind F1 send-keys F1
bind F2 send-keys F2
bind F3 send-keys F3
bind F4 send-keys F4
bind F5 send-keys F5
bind F6 send-keys F6
bind F7 send-keys F7
bind F8 send-keys F8
bind F9 send-keys F9
bind F10 send-keys F10
# F12 to swap to last window.
bind -n F12 last-window
# Plugins.
# Tmux Plugin Manager.
# <prefix>I = install
# <prefix>U = update
# <prefix><alt>U = clean
set -g @plugin 'tmux-plugins/tpm'
# Improved navigation between vim and tmux panes (C-h/C-j/C-k/C-l).
set -g @plugin 'christoomey/vim-tmux-navigator'
# Reasonable default Tmux settings.
# <prefix>R = source-file ~/.tmux.conf
set -g @plugin 'tmux-plugins/tmux-sensible'
# Battery indicator in status bar.
set -g @plugin 'tmux-plugins/tmux-battery'
# Open FZF pane and allow selection of any URLs from current pane to open
# (<prefix>f).
set -g @plugin 'wfxr/tmux-fzf-url'
set -g @fzf-url-bind 'f'
run '~/.tmux/plugins/tpm/tpm'