-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtmux.conf
108 lines (87 loc) · 3.33 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
#~/.tmux.conf - tmux terminal multiplexer config
# Based heavily on Thayer Wiliams' (http://cinderwick.ca) and Jason Ryan's (http://jasonwryan.com/)
## set prefix key to ctrl+a
unbind C-b
set -g prefix C-a
bind C-a send-prefix
set -g mouse on
set -g default-command /bin/zsh
set -s escape-time 20
# setting true colors
#set -g default-terminal "tmux-256color"
set -ag terminal-overrides ",xterm-256color:Tc"
# reload config without killing server
bind-key r source-file ~/.tmux.conf \; display-message "~/.tmux.conf reloaded"
# Smart pane switching with awareness of Vim splits.
# See: https://github.com/christoomey/vim-tmux-navigator
is_vim="ps -o state= -o comm= -t '#{pane_tty}' \
| grep -iqE '^[^TXZ ]+ +(\\S+\\/)?g?(view|n?vim?x?)(diff)?$'"
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'"
## open window and panes in current path and use more intuitive bindings
unbind c
bind c new-window -c "#{pane_current_path}"
unbind %
bind h split-window -v -c "#{pane_current_path}"
unbind '"'
bind v split-window -h -c "#{pane_current_path}"
## set vi keys
unbind p
bind p paste-buffer
unbind [
bind Escape copy-mode
setw -g mode-keys vi
bind -T copy-mode-vi v send-keys -X begin-selection
bind -T copy-mode-vi y send-keys -X copy-selection-and-cancel
## confirm before killing a window or the server
bind k confirm kill-window
bind K confirm kill-server
## toggle statusbar
bind b set-option status
## start window indexing at one instead of zero
set -g base-index 1
## switch windows alt+number
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
## switch between panes faster
bind -n M-l next-window
bind -n M-h previous-window
## switch between clients faster
bind -n M-n switch-client -p
bind -n M-p switch-client -n
## scrollback buffer n lines
set -g renumber-windows on
## scrollback buffer n lines
set -g history-limit 50000
## listen for activity on all windows
set -g monitor-bell on
set -g bell-action any
## enable wm window titles
set -g set-titles on
## statusbar --------------------------------------------------------------
set -g status-style "bg=default,fg=colour8"
set -g status-left ' #S '
set -g status-left-style "bg=colour166,fg=colour229"
set -g status-right ''
#### pane border
set -g pane-border-style "fg=colour236"
set -g pane-active-border-style "fg=colour33"
#### message text
set -g message-style "bg=colour33,fg=colour231"
#### window list
set -g window-status-format "#[fg=colour8] #I #[fg=colour231]#T#[fg=colour166]#F "
set -g window-status-current-format "#[fg=colour117,bg=colour31] #I #[fg=colour231]#T#[fg=colour234]#F "