-
Notifications
You must be signed in to change notification settings - Fork 1
/
tmux.conf
101 lines (75 loc) · 2.55 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
set-window-option -g mode-keys vi
# Change prefix key to C-a
set -g prefix C-a
bind-key C-a send-prefix
# Kill window.
bind X kill-window
# Reloading tmux.
bind r \
source-file ~/.tmux.conf\; \
display-message "Config reloaded."
# Synchronize panes on/off with C-a a
bind-key a \
set-window-option synchronize-panes\; \
display-message "synchronize-panes is now #{?pane_synchronized,on,off}"
# Vi split
bind s split-window -v -c "#{pane_current_path}"
bind v split-window -h -c "#{pane_current_path}"
bind c new-window -c "#{pane_current_path}"
# Switch panes using Alt-hjkl without prefix.
bind -n M-k select-pane -U
bind -n M-j select-pane -D
bind -n M-h select-pane -L
bind -n M-l select-pane -R
# Switch window using Alt-hl without prefix.
bind -n M-H previous-window
bind -n M-L next-window
# Resize window using Alt -+<>
bind -n M-- resize-pane -D
bind -n M-+ resize-pane -U
bind -n M-< resize-pane -L
bind -n M-> resize-pane -R
# Swap windows using Alt-JK without prefix.
bind -n M-K swap-pane -U
bind -n M-J swap-pane -D
# Vim select and copy
bind-key -T copy-mode-vi 'v' send -X begin-selection
bind-key -T copy-mode-vi 'y' send -X copy-selection-and-cancel
# copy mode
bind C-c copy-mode
bind C-p paste-buffer
# Balance panes prefix + Alt+2/Alt+1
bind = select-layout even-vertical
# Reorder windows easily.
bind R \
set -g renumber-windows on\; \
new-window\; kill-window\; \
set -g renumber-windows off\; \
display-message "Windows reordered..."
# wanted by neovim
set-option -sg escape-time 10 # command delay.
set-option -g repeat-time 0 # Allow keys to be used immediately after changing panes.
set-option -g focus-events on
set-option -g default-terminal "screen-256color"
set-option -sa terminal-overrides ',xterm-256color:RGB'
# Status line.
set-option -g status-right '' # Remove hostname, date, and time.
set-option -g status-position top # Move status position to top.
set-option -g status-style fg=black,bg=yellow
# Automatically update DISPLAY env variable for all panes
if-shell -b 'test -f "$HOME/.local/bin/display_update"' {
set-hook -g client-attached 'run-shell "$HOME/.local/bin/display_update"'
}
# Set default shell.
set-option -g default-shell /bin/bash
# Plugins
set -g @plugin 'nhdaly/tmux-better-mouse-mode' # to better manage the mouse.
set -g @plugin 'tmux-plugins/tmux-resurrect' # Restore tmux session after system restart.
## tmux-resurrect
## prefix + Ctrl-s - save
## prefix + Ctrl-r - restore
## tmux-better-mouse-mode.
set-option -g mouse on
# Tmux plugin manager.
# Install plugins with prefix + I.
run '~/.tmux/plugins/tpm/tpm'