-
Notifications
You must be signed in to change notification settings - Fork 0
/
.tmux.conf
89 lines (76 loc) · 3.57 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
# vim compatibility with tmux C-direction
is_vim="ps -o state= -o comm= -t $(tmux display-message -p '#{pane_tty}') | grep -iqE '^[^TXZ ]+ +(\\S+\\/)?g?(view|n?vim?x?)(diff)?$'"
is_fzf="ps -o state= -o comm= -t $(tmux display-message -p '#{pane_tty}') | grep -iqE '^[^TXZ ]+ +(\\S+\\/)?fzf$'"
bind -n C-h run "($is_vim && tmux send-keys C-h) || tmux select-pane -L"
bind -n C-j run "($is_vim && tmux send-keys C-j) || ($is_fzf && tmux send-keys C-j) || tmux select-pane -D"
bind -n C-k run "($is_vim && tmux send-keys C-k) || ($is_fzf && tmux send-keys C-k) || tmux select-pane -U"
bind -n C-l run "($is_vim && tmux send-keys C-l) || tmux select-pane -R"
bind -n C-n run "($is_vim && tmux send-keys C-n) || tmux next-window"
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'"
bind-key -T copy-mode-vi 'C-h' select-pane -L
bind-key -T copy-mode-vi 'C-j' select-pane -D
bind-key -T copy-mode-vi 'C-k' select-pane -U
bind-key -T copy-mode-vi 'C-l' select-pane -R
bind-key -T copy-mode-vi 'C-\' select-pane -l
bind-key -T prefix 'C-r' source-file ~/.tmux.conf
bind-key -T prefix 'j' swap-pane -U
bind-key -T prefix 'k' swap-pane -D
bind-key -T prefix '}' select-pane -R \; swap-pane -s '!'
bind-key -T prefix '{' select-pane -L \; swap-pane -s '!'
bind-key -T prefix 'C-j' resize-pane -D
bind-key -T prefix 'C-k' resize-pane -U
bind-key -T prefix 'C-h' resize-pane -L
bind-key -T prefix 'C-l' resize-pane -R
#extra keybinds
bind-key -n C-S-Left swap-window -t -1\; select-window -t -1
bind-key -n C-S-Right swap-window -t +1\; select-window -t +1
bind | split-window -h -c "#{pane_current_path}"
bind - split-window -v -c "#{pane_current_path}"
#copypaste setup
# ctrl+c to send to clipboard
bind C-S-c run "tmux save-buffer - | xclip -i -sel clipboard"
# ctrl+v to paste from clipboard
bind C-S-v run "tmux set-buffer \"$(xclip -o -sel clipboard)\"; tmux paste-buffer"
#this will copy anything that is selected automatically
unbind -n -Tcopy-mode-vi MouseDragEnd1Pane
bind -Tcopy-mode-vi MouseDragEnd1Pane send -X copy-selection-and-cancel\; run "tmux save-buffer - | xclip -i -sel clipboard > /dev/null"
unbind-key MouseDown2Pane
bind-key -n MouseDown2Pane run " \
X=$(xclip -o -sel clipboard); \
tmux set-buffer \"$X\"; \
tmux paste-buffer -p; \
tmux display-message 'pasted!' \
"
# Drag to re-order windows
bind-key -n MouseDrag1Status swap-window -t=
# vim compatibility to allow for esc to be usec
set-option -s escape-time 0
# renumber windows so there aren't weird gaps after closing a window
set-option -g renumber-windows on
set -g default-terminal "tmux-256color"
# rebind the leader
unbind C-b
set-option -g prefix C-space
bind-key C-space send-prefix
# TMUX PLUGINS
## plugin settings
### tmux-sidebar
set -g @sidebar-tree-position 'right'
set -g @sidebar-tree-command 'tree -C'
set -g @sidebar-tree-pager 'less -R'
## Plugin list
set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'tmux-plugins/tmux-sensible'
set -g @plugin 'egel/tmux-gruvbox'
set -g @plugin 'tmux-plugins/tmux-sidebar'
set -g @plugin 'tmux-plugins/tmux-resurrect'
set -g @plugin 'tmux-plugins/tmux-yank'
set -g @plugin 'tmux-plugins/tmux-prefix-highlight'
set -g @plugin 'sainnhe/tmux-fzf'
set -g @plugin 'b0o/tmux-autoreload'
# Initialize TMUX plugin manager (keep this line at the very bottom of tmux.conf)
run -b '~/.tmux/plugins/tpm/tpm'