-
Notifications
You must be signed in to change notification settings - Fork 0
/
.tmux.conf
103 lines (86 loc) · 2.98 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
# Plugins
set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'tmux-plugins/tmux-sensible'
set -g @plugin 'tmux-plugins/tmux-yank'
run -b '~/.tmux/plugins/tpm/tpm'
# Colors
set -g default-terminal 'tmux-256color'
# Vi mode
setw -g mode-keys vi
bind-key -T copy-mode-vi v send-keys -X begin-selection
bind-key -T copy-mode-vi y send-keys -X copy-selection
bind-key -T copy-mode-vi C-v send-keys -X rectangle-toggle
# tmux-yank
# "By default, tmux-yank will exit copy mode after yanking text.
# If you wish to remain in copy mode, you can set @yank_action"
# https://github.com/tmux-plugins/tmux-yank#controlling-yank-behavior
set -g @yank_action 'copy-pipe' # or 'copy-pipe-and-cancel' for the default
# Remap prefix
unbind C-b
set -g prefix C-Space
bind-key C-Space send-prefix
# Reload config
bind r source-file ~/.tmux.conf \; display-message "Configuration reloaded"
# Windows & panes start at index 1, and renumber upon windows closing
set -g base-index 1
setw -g pane-base-index 1
set-option -g renumber-windows on
# Split panes using v and s
# Also open panes & windows in current path
bind v split-window -h -c '#{pane_current_path}'
unbind '"'
bind s split-window -v -c '#{pane_current_path}'
unbind %
bind t new-window -c '#{pane_current_path}' -a -t +1
unbind c
# vim-tmux-navigator with custom bindings {{{
is_vim="ps -o state= -o comm= -t '#{pane_tty}' \
| grep -iqE '^[^TXZ ]+ +(\\S+\\/)?g?(view|n?vim?x?)(diff)?$'"
bind-key -n M-h if-shell "$is_vim" 'send-keys M-h' 'select-pane -L'
bind-key -n M-j if-shell "$is_vim" 'send-keys M-j' 'select-pane -D'
bind-key -n M-k if-shell "$is_vim" 'send-keys M-k' 'select-pane -U'
bind-key -n M-l if-shell "$is_vim" 'send-keys M-l' 'select-pane -R'
bind-key -T copy-mode-vi M-h select-pane -L
bind-key -T copy-mode-vi M-j select-pane -D
bind-key -T copy-mode-vi M-k select-pane -U
bind-key -T copy-mode-vi M-l select-pane -R
# }}}
# Fast window navigation
bind -n M-n next-window
bind -n M-p previous-window
bind -n 'M-;' last-window
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
# Swap panes
bind H swap-pane -s -
bind L swap-pane -s +
bind K swap-pane -U
bind J swap-pane -D
# Resize panes
bind -n C-S-Up resize-pane -U 5
bind -n C-S-Down resize-pane -D 5
bind -n C-S-Left resize-pane -L 5
bind -n C-S-Right resize-pane -R 5
# Swap windows
bind -n M-Left { swap-window -t -1; previous-window }
bind -n M-Right { swap-window -t +1; next-window }
# Mouse control
set -g mouse on
# Status bar {{{
set -g status-justify 'centre'
# https://stackoverflow.com/questions/22303820/tmux-transparent-status-bar
set -g status-style bg=default
set -g status-fg white
set -g status-interval 10
set -g status-left ' #I:#P'
set -g status-right '%l:%M '
setw -g window-status-format ' #I #W '
setw -g window-status-current-format '#[fg=colour208] #I #W '
# }}}