-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtmux.conf
73 lines (57 loc) · 2.8 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
# interface: improve colors
set -g default-terminal "tmux-256color"
set-option -sa terminal-overrides ",xterm*:Tc"
# interface: soften status bar color from harsh green to light gray
# set -g status-style bg='#666666',fg='#aaaaaa'
# interface: remove administrative debris (session name, hostname, time) in status bar
set -g set-titles on
set -g set-titles-string "#{session_name}"
# navigation: vim: pane navigate
is_vim="ps -o state= -o comm= -t '#{pane_tty}' | grep -iqE '^[^TXZ ]+ +(\\S+\\/)?g?(view|n?vim?x?)(diff)?$'"
bind -n 'C-h' if-shell "$is_vim" 'send-keys C-h' { if -F '#{pane_at_left}' '' 'select-pane -L' }
bind -n 'C-j' if-shell "$is_vim" 'send-keys C-j' { if -F '#{pane_at_bottom}' '' 'select-pane -D' }
bind -n 'C-k' if-shell "$is_vim" 'send-keys C-k' { if -F '#{pane_at_top}' '' 'select-pane -U' }
bind -n 'C-l' if-shell "$is_vim" 'send-keys C-l' { if -F '#{pane_at_right}' '' 'select-pane -R' }
bind -T copy-mode-vi 'C-h' if -F '#{pane_at_left}' '' 'select-pane -L'
bind -T copy-mode-vi 'C-j' if -F '#{pane_at_bottom}' '' 'select-pane -D'
bind -T copy-mode-vi 'C-k' if -F '#{pane_at_top}' '' 'select-pane -U'
bind -T copy-mode-vi 'C-l' if -F '#{pane_at_right}' '' 'select-pane -R'
set-window-option mode-keys vi
# navigation: vim: create new panes and windows, them being relative to current path
bind v split-window -c "#{pane_current_path}"
bind s split-window -h -c "#{pane_current_path}"
bind t new-window -c "#{pane_current_path}"
# navigation: vim: copy mode using esc, like when existing insert mode
unbind [
bind Escape copy-mode
# navigation: start window numbers at 1 to match keyboard order
set -g base-index 1
set-window-option -g pane-base-index 1
# navigation: renumber windows sequentially after closing any of them
set -g renumber-windows on
# utility: increase scrollback lines
set -g history-limit 100000
# make delay shorter
set -sg escape-time 0
# enable mouse support for switching panes/windows
set -g mouse on
# utility: don't suspend-client with key on accident, use prompt instead
unbind C-z
# utility: reload config file with r key
bind r source-file ~/.tmux.conf \; display "Config reloaded for Tmux!"
# automatically restore env when tmux is started without any other action
# set -g @continuum-restore 'on'
set -g @continuum-save-interval '0' # auto-save interval in minutes, 0 disables
set -g status-right 'Continuum status: #{continuum_status}'
set -g @resurrect-save 'C-s'
set -g @resurrect-restore 'C-r'
# tmux plugin manager https://github.com/tmux-plugins/tpm
set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'tmux-plugins/tmux-resurrect'
set -g @plugin 'tmux-plugins/tmux-continuum'
set -g @plugin 'odedlaz/tmux-onedark-theme'
run '~/.tmux/plugins/tpm/tpm'
# prefix -> back-one-character
# bind-key C-b send-prefix
# prefix-2 -> forward-incremental-history-search
# bind-key C-s send-prefix -2