-
Notifications
You must be signed in to change notification settings - Fork 0
/
.tmux.conf
98 lines (77 loc) · 2.79 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
set -g default-terminal xterm-256color
set -g status-right "#S:#H"
set -g status-bg colour40
setw -g window-status-current-style bg=colour40 # new tmux
# nested tmux
bind -n S-left prev
bind -n S-right next
bind -n S-C-left swap-window -t -1
bind -n S-C-right swap-window -t +1
bind -n M-F11 set -qg status-bg colour25
bind -n M-F12 set -qg status-bg colour40
bind -n S-up \
send-keys M-F12 \; \
set -qg status-bg colour25 \; \
unbind -n S-left \; \
unbind -n S-right \; \
unbind -n S-C-left \; \
unbind -n S-C-right \; \
set -qg prefix C-a
bind -n S-down \
send-keys M-F11 \; \
set -qg status-bg colour40 \; \
bind -n S-left prev \; \
bind -n S-right next \; \
bind -n S-C-left swap-window -t -1 \; \
bind -n S-C-right swap-window -t +1 \; \
set -qg prefix C-b
# Bind reload key
bind r source-file ~/.tmux.conf \; display-message "Config reloaded..."
# allow neovim to escape INSERT mode quickly
#set -sg escape-time 0
# configure default shell (zsh)
set-option -g default-shell $SHELL
# switch active pane w/ vim keys
bind j select-pane -D
bind k select-pane -U
bind h select-pane -L
bind l select-pane -R
# use Ctrl + vim keys to move around
# https://blog.bugsnag.com/tmux-and-vim
is_vim="ps -o state= -o comm= -t '#{pane_tty}' \
| grep -iqE '^[^TXZ ]+ +(\\S+\\/)?g?(view|n?vim?x?)(diff)?$'"
is_fzf="ps -o state= -o comm= -t '#{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-\' if-shell "$is_vim" "send-keys 'C-\\'" "select-pane -l"
# source: https://www.rockyourcode.com/copy-and-paste-in-tmux/
## Use vim keybindings in copy mode
#set-option -g mouse on
setw -g mode-keys vi
set-option -s set-clipboard off
#bind P paste-buffer
unbind p
bind p paste-buffer
# copy to the paste buffer
bind-key -T copy-mode-vi v send-keys -X begin-selection
bind-key -T copy-mode-vi y send-keys -X rectangle-toggle
unbind -T copy-mode-vi Enter
# share tmux paste buffer to OS clipboard
bind-key -T copy-mode-vi Enter send-keys -X copy-pipe-and-cancel 'wl-copy'
bind-key -T copy-mode-vi MouseDragEnd1Pane send-keys -X copy-pipe-and-cancel 'wl-copy'
# TODO: patch up
# Copy to both clipboard and tmux copy
# macOS
# bind -T copy-mode-vi Enter send-keys -X copy-pipe-and-cancel "pbcopy"
# linux
# bind -T copy-mode-vi Enter send-keys -X copy-pipe-and-cancel "xclip -se c -i"
# bind -T copy-mode-vi "V" send-keys -X rectangle-toggle