-
Notifications
You must be signed in to change notification settings - Fork 2
/
.tmux.conf
141 lines (116 loc) · 4.63 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
# tmux version 2.5
set -g default-terminal "screen-256color"
# set-environment -g 'SSH_AUTH_SOCK' ~/.ssh/ssh_auth_sock
# only need on mac
# set -g default-command "exec reattach-to-user-namespace -l /bin/bash"
# utf8 on
# set -g utf8 on
# set -g status-utf8 on
# address vim mode switching delay (http://superuser.com/a/252717/65504)
set -s escape-time 0
# Prefix is Ctrl-a
unbind C-b
set -g prefix C-a
bind C-a send-prefix
set -g base-index 1
setw -g pane-base-index 1
# Mouse works as expected
# shift-click to select without copying
set -g mouse on
set-option -s set-clipboard off # https://unix.stackexchange.com/questions/348913/copy-selection-to-a-clipboard-in-tmux
# bind-key -T root MouseDrag1Pane select-pane ; send-keys -X begin-selection
# bind-key -T copy-mode MouseDrag1Pane select-pane ; send-keys -X begin-selection
# unbind-key -T copy-mode MouseDragEnd1Pane
# unbind-key -T copy-mode-vi MouseDragEnd1Pane
setw -g monitor-activity on
set -g visual-activity off
set -g history-limit 50000
# more vim like keybindings in copy mode
set -g mode-keys vi
unbind p # by default it switches to previous window
bind p paste-buffer
bind-key -T copy-mode-vi 'v' send-keys -X begin-selection
# Copy paste
bind-key -T copy-mode-vi 'y' send-keys -X copy-pipe-and-cancel "xclip -i -f -selection primary | xclip -i -selection clipboard"
# bind-key -T copy-mode-vi y send-keys -X copy-pipe-and-cancel 'xclip -sel clip -i'
# easy-to-remember split pane commands
bind | split-window -h
bind - split-window -v
unbind '"'
unbind %
# moving between panes with vim movement keys
bind h select-pane -L
bind j select-pane -D
bind k select-pane -U
bind l select-pane -R
# moving between windows with vim movement keys
bind -r C-h select-window -t :-
bind -r C-l select-window -t :+
# moving between windows with tab
# doesn't work
# bind -r C-Tab select-window -t :+
# bind -r C-S-Tab previous-window
bind r source-file $HOME/.tmux.conf
# resize panes with vim movement keys
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
bind C-t new-window -P
# Smart pane switching with awareness of vim splits
# https://github.com/christoomey/vim-tmux-navigator
is_vim='echo "#{pane_current_command}" | grep -iqE "(^|\/)g?(view|n?vim?)(diff)?$"'
bind -n C-h if-shell "$is_vim" "send-keys C-h" "select-pane -L"
bind -n C-j if-shell "$is_vim" "send-keys C-j" "select-pane -D"
bind -n C-k if-shell "$is_vim" "send-keys C-k" "select-pane -U"
bind -n C-l if-shell "$is_vim" "send-keys C-l" "select-pane -R"
# bind -n C-\ if-shell "$is_vim" "send-keys C-\\" "select-pane -l"
# theme (matches vim airline theme papercolor) {{{
set -g message-style fg='#e4e4e4',bg='#0087af'
# message when typing command
set -g status-style fg='#e4e4e4',bg='#005f87' # status bar
set -g window-status-current-style fg='#585858',bg='#e4e4e4'
set -g window-status-current-format ' #I) #W '
set -g window-status-format ' #I) #W '
# set -g window-status-bell-style bg=red
set -g window-status-activity-style blink
set -g status-interval 10
# set -g window-style fg=black
set -g pane-active-border-style fg='#0087af'
# set -g pane-border-style bg='#008Vaf'
set -g status-left '#{?client_prefix,#[bold],} #(whoami) 𝛌 #S '
set -g status-left-length 30
set -g status-left-style bg='#0087af',fg='#e4e4e4'
set -g status-right ' #(cut -d " " -f 1-3 /proc/loadavg) %m/%d %H:%M '
set -g status-right-style fg='#e4e4e4',bg='#0087af'
# }}}
# automatically renumber windows starting from base-index when a window is closed
set -g renumber-windows on
# ssh-agent
# https://werat.github.io/2017/02/04/tmux-ssh-agent-forwarding.html
# set-environment -g 'SSH_AUTH_SOCK' ~/.ssh/ssh_auth_sock
# run-shell ~/src/tmux-resurrect/resurrect.tmux
# List of plugins
# prefix + I to fetch new plugins
# prefix + U to update plugins
set -g @plugin 'tmux-plugins/tpm'
# aggresive-resize not compatible with iTerm2 tmux integration
# https://github.com/tmux-plugins/tmux-sensible/issues/24
# set -g @plugin 'tmux-plugins/tmux-sensible'
set -g @plugin 'tmux-plugins/tmux-copycat'
set -g @plugin 'tmux-plugins/tmux-open'
# set -g @plugin 'tmux-plugins/tmux-yank'
# Make tab selection easier.
# tmux doesn't recognize Super/Command key, so have to use Meta (Alt).
# However with iTerm2 tmux integration, we can use Cmd+<n>.
# 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
# Initialize TMUX plugin manager (keep this line at the very bottom of tmux.conf)
run '~/.tmux/plugins/tpm/tpm'