-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtmux.conf
More file actions
142 lines (114 loc) · 4.35 KB
/
tmux.conf
File metadata and controls
142 lines (114 loc) · 4.35 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
# =================================================
# Various options
# =================================================
# Use C-a instead of C-b
unbind C-b
set-option -g prefix C-a
bind-key C-a send-prefix
# Enable new mouse mode
set -g mouse on
set -g set-clipboard off
# History size limit
set -g history-limit 50000
# No delay for escape key press
set -sg escape-time 1
# Set base index to 1, not 0
# ...because of general keyboard layout?
set -g base-index 1
setw -g pane-base-index 1
# Reload config easily
# - ^a + r to reload configuration
bind r source-file ~/.tmux.conf \; display ".tmux.conf reloaded"
# Focus events enabled for terminals that support them
set -g focus-events on
# Enable vi style copy & paste
set-window-option -g mode-keys vi
# Disable window title automatic renaming
set-window-option -g automatic-rename off
# Synchronize panes
# - Send a command across all panes in current window
# - ^a + e : sync on
# - ^a + shift + e : sync off
bind e setw synchronize-panes on
bind E setw synchronize-panes off
# Move windows left/right
bind -n S-Left swap-window -t -1
bind -n S-Right swap-window -t +1
# Swap panes left/right
# ^a => { or }
# =================================================
# Status bar
# =================================================
# Interval
set -g status-interval 2
# =================================================
# Smart pane switching with awareness of Vim splits.
# - https://github.com/christoomey/vim-tmux-navigator
# - https://www.bugsnag.com/blog/tmux-and-vim/
# =================================================
is_vim="ps -o state= -o comm= -t '#{pane_tty}' \
| grep -iqE '^[^TXZ ]+ +(\\S+\\/)?g?(view|l?n?vim?x?)(diff)?$'"
is_fzf="ps -o state= -o comm= -t '#{pane_tty}' \
| grep -iqE '^[^TXZ ]+ +(\\S+\\/)?fzf$'"
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
# =================================================
# Split pane with (| and -) instead of (" and %)
# =================================================
bind | split-window -h -c "#{pane_current_path}"
bind - split-window -v -c "#{pane_current_path}"
unbind '"'
unbind %
# =================================================
# Plugins list
# =================================================
# To install plugins, ^a + I
# To update plugins, ^a + u
set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'tmux-plugins/tmux-sensible'
set -g @plugin 'tmux-plugins/tmux-yank'
set -g @plugin 'tmux-plugins/tmux-resurrect'
set -g @plugin 'tmux-plugins/tmux-continuum'
set -g @plugin 'tmux-plugins/tmux-sessionist'
set -g @plugin 'tmux-plugins/tmux-logging'
set -g @plugin 'christoomey/vim-tmux-navigator'
set -g @plugin 'dracula/tmux'
set -g @dracula-show-powerline true
set -g @dracula-plugins "git"
set -g @dracula-show-flags true
set -g @dracula-show-left-icon session
set -g status-position top
set-window-option -g window-status-separator ''
# tmux-yank
# - already explained above
run-shell ~/.tmux/plugins/tmux-yank/yank.tmux
# tmux-resurrect
# - useful when pc restarts
# - save session: ^a => ^s
# - restore session: ^a => ^r
run-shell ~/.tmux/plugins/tmux-resurrect/resurrect.tmux
# tmux-continuum
# - continuous session backup(every 15 mins)
# - automatic restore
set -g @continuum-restore 'off'
run-shell ~/.tmux/plugins/tmux-continuum/continuum.tmux
# tmux-sessionist
run-shell ~/.tmux/plugins/tmux-sessionist/sessionist.tmux
# tmux-logging
run-shell ~/.tmux/plugins/tmux-logging/logging.tmux
# =================================================
# Run tpm (should be bottom of this file)
# =================================================
run '~/.tmux/plugins/tpm/tpm'