-
Notifications
You must be signed in to change notification settings - Fork 0
/
.tmux.conf
95 lines (71 loc) · 3.41 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
set -g default-terminal "screen-256color"
# set binding to C-a rather than C-b
set-option -g prefix C-a
unbind-key C-a
bind-key C-a send-prefix
set -g base-index 1
set-window-option -g aggressive-resize
# make the mouse scroll put the tmux pane into visual mode
set-window-option -g mouse on
# two things: drag selection with the mouse will limit itself to the pane and copy to the system clipboard
bind -T copy-mode-vi MouseDragEnd1Pane send-keys -X copy-pipe-and-cancel 'xsel -i --clipboard'
# reload conf shortcut
bind-key R source-file ~/.tmux.conf\; display-message "tmux.conf reloaded"
# use vi bindings rather than emacs
setw -g mode-keys vi
# use vi like bindings for panes and movement
bind-key s split-window -v -c "#{pane_current_path}"
bind-key v split-window -h -c "#{pane_current_path}"
bind-key S split-window -vf -c "#{pane_current_path}"
bind-key V split-window -hf -c "#{pane_current_path}"
# bind-key h select-pane -L
# bind-key j select-pane -D
# bind-key k select-pane -U
# bind-key l select-pane -R
# taken from https://github.com/tmux/tmux/issues/47#issuecomment-344426764
# dont wrap around if youre at an edge pane.
bind k run-shell "if [ $(tmux display-message -p '#{pane_at_top}') -ne 1 ]; then tmux select-pane -U; fi"
bind j run-shell "if [ $(tmux display-message -p '#{pane_at_bottom}') -ne 1 ] ; then tmux select-pane -D; fi"
bind l run-shell "if [ $(tmux display-message -p '#{pane_at_right}') -ne 1 ]; then tmux select-pane -R; fi"
bind h run-shell "if [ $(tmux display-message -p '#{pane_at_left}') -ne 1 ]; then tmux select-pane -L; fi"
# resize the pane by 10 in the direction specified
bind-key J resize-pane -D 5 # (resizes the current pane down by 10 cells)
bind-key K resize-pane -U 5 # (resizes the current pane upward by 10 cells)
bind-key H resize-pane -L 5 # (resizes the current pane left by 10 cells)
bind-key L resize-pane -R 5 # (resizes the current pane right by 10 cells)
# unbind the arrow keys
unbind up
unbind down
unbind left
unbind right
unbind \;
unbind C-Up
unbind C-Down
unbind C-Left
unbind C-Right
# dont make tmux wait for escape key
set -sg escape-time 0
bind -T copy-mode-vi v send-keys -X begin-selection
# xsel approach to copying from tmux to clipboard (on remote machine this will be the remote clipboard)
bind -T copy-mode-vi y send-keys -X copy-pipe-and-cancel 'xsel -i --clipboard'
# M- is the alt key
bind-key -n M-y choose-buffer 'run-shell "tmux save-buffer -b \"%%%\" - | yank > #{pane_tty}"'
bind P run 'xsel -o | tmux load-buffer - ; tmux paste-buffer'
set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'tmux-plugins/tmux-resurrect'
set -g @resurrect-strategy-vim 'session'
set -g @plugin 'tmux-plugins/tmux-continuum'
set -g @continuum-restore 'on'
set -g @continuum-save-interval '15'
set -g @plugin 'tmux-plugins/tmux-battery'
set -g @plugin 'tmux-plugins/tmux-online-status'
# make sure that vim focus events are on
set -g focus-events on
# set -g @resurrect-strategy-vim 'session'
# set status bar right side to be bigger
set -g status-right-length 200
set -g @online_icon "ok"
set -g @offline_icon "offline!"
# show battery level in tmux status bar
set -g status-right "RAM: #(~/scripts/usedram.bash)% | Continuum status: #{continuum_status} | Online: #{online_status} | Vpn: #(nmcli --terse con show --active | grep -i vpn | awk -F ':' '{print $3}') | Battery: #{battery_icon} #{battery_percentage} #{battery_remain} | %a %h-%d %H:%M "
run -b '~/.tmux/plugins/tpm/tpm'