-
Notifications
You must be signed in to change notification settings - Fork 2
/
.tmux.conf
151 lines (121 loc) · 4.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
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
# 256 colors, use screen-based terminal with terminal multiplexers such as tmux
set -g default-terminal 'screen-256color'
# fish-shell <°))><
# Isolating tmux windows to prevent systemd-oomd from killing entire server
set -g default-command 'systemd-run --user --scope --quiet /usr/bin/fish'
set -g default-shell /usr/bin/fish
# emacs-style in the status line, vi-style in copy mode
# both default to emacs unless EDITOR is set and contains 'vi'
set -gw mode-keys vi
set -gw status-keys emacs
# Change prefix to C-a
unbind C-b
set -g prefix C-a
# Increase scrollback buffer size
set -g history-limit 100000
# Address vim mode switching delay
# https://superuser.com/a/252717/107828
set -sg escape-time 0
# Allow xterm keys (C-Left, S-up etc)
setw -g xterm-keys on
# Disable visual and audible bell
set -g bell-action none
set -g visual-bell off
# Start window indexing at 1 instead of 0
set -g base-index 1
# Reload config without killing server
bind R source $HOME/.tmux.conf
bind R source ~/.tmux.conf
# Confirm before killing window/server
bind k confirm kill-window
bind K confirm kill-server
# Open a man page in a new window
bind m command-prompt "split-window 'exec man %%'"
# Border colours
set -g pane-active-border-style bg=default,fg=cyan
# Enable window titles, follows status-left formatting:
# http://manpages.ubuntu.com/manpages/precise/en/man1/tmux.1.html
set -g set-titles on
set -g set-titles-string "tmux:#I [ #W ]"
# Disallow applications renaming window title
setw -g allow-rename off
# Toogle statusbar
bind b set status
# Statusbar
set -g status-interval 1
set -g status-justify centre # center align window list
set -g status-left-length 20
set -g status-left '#[fg=blue]#(whoami) #[fg=black]• #[fg=cyan]#H #[fg=black]#{?pane_synchronized,•,} #[fg=white,reverse,blink]#{?pane_synchronized,SYNCED,}'
set -g status-right '#[fg=cyan]%H:%M • #[fg=blue]%d.%m.%y#[default]'
# Default statusbar colors
set -g status-style bg=default,fg=white,bright
# Command/message line colors
set -g message-style bg=black,fg=white,bright
# Toggle window synchronization
bind y setw synchronize-panes
# Splitting keybindings
# Opens pane in the same current working directory
unbind %
bind V split-window -v -c "#{pane_current_path}"
unbind '"'
bind v split-window -h -c "#{pane_current_path}"
# Alt (meta) plus index pane selection
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
bind -n M-0 select-window -t 10
# Pane control inspired by tmux-plugins/tmux-pain-control
bind j select-pane -D ; bind C-j select-pane -D
bind k select-pane -U ; bind C-k select-pane -U
bind h select-pane -L ; bind C-h select-pane -L
bind l select-pane -R ; bind C-l select-pane -R
bind -r "<" swap-window -t -1
bind -r ">" swap-window -t +1
bind -r H resize-pane -L 5
bind -r J resize-pane -D 5
bind -r K resize-pane -U 5
bind -r L resize-pane -R 5
# Switch between alternate windows
bind C-a send-prefix
bind a last-window
# Open new window to the right (after) currently active one
bind c new-window -a
# Renumber windows automatically as they are closed, as with 'move-window -r'
set -g renumber-windows on
# Source local configuration if it exists
source -q $HOME/.tmux.conf.local
# TODO: possible candidates:
# - https://github.com/dominikduda/tmux_mode_indicator
# - https://github.com/tmux-plugins/tmux-sidebar
# Tmux plugin manager and plugins
set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'jaclu/tmux-menus'
set -g @plugin 'tmux-plugins/tmux-resurrect'
set -g @plugin 'tmux-plugins/tmux-yank'
# Plugin settings
set -g @resurrect-processes 'ssh'
set -g @resurrect-capture-pane-contents 'on'
# Explicitly unbind default tmux-resurrect keybinds
# Save/restore manually using:
# run-shell "~/.tmux/plugins/tmux-resurrect/scripts/save.sh"
# run-shell "~/.tmux/plugins/tmux-resurrect/scripts/restore.sh"
# (Prefix 'bind-key "C-s"' to reapply bind)
set -g @resurrect-save 'C-s'
set -g @resurrect-restore 'C-r'
unbind C-s
unbind C-r
# Initialize tmux plugin manager
# https://github.com/tmux-plugins/tpm/blob/master/docs/automatic_tpm_installation.md
# https://github.com/tmux-plugins/tpm/pull/99
# https://github.com/tmux-plugins/tpm/issues/105
setenv -g TMUX_PLUGIN_MANAGER_PATH '$HOME/.tmux/plugins/'
if "test ! -d ~/.tmux/plugins/tpm" \
"run 'git clone https://github.com/tmux-plugins/tpm.git ~/.tmux/plugins/tpm \
&& ~/.tmux/plugins/tpm/bin/install_plugins'"
run '~/.tmux/plugins/tpm/tpm'