-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.tmux.conf
70 lines (54 loc) · 2.37 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
set -g default-terminal "xterm-256color"
# Change prefix to C-a.
set-option -g prefix M-a
# Bind a for send the prefix to shell/nested tmux.
bind a send-prefix
# Start window number at 1.
set -g base-index 1
# is_vim="ps -o state= -o comm= -t '#{pane_tty}' \
# | grep -iqE '^[^TXZ ]+ +(\\S+\\/)?g?(view|n?vim?x?)(diff)?$'"
is_vim="ps -o state= -o comm= -o pid= \
| grep -iE '^[^TXZ]+ +(\\S+\\/)?g?(view|n?vim?x?)(diff)? +(\\S+\\/)?[0-9]+$' \
| sed 's/^.* \\([0-9]*\\)$/\\/proc\\/\\1\\/fd\\/0/g' \
| xargs -n1 readlink \
| grep -q '#{pane_tty}'"
bind-key -n M-h if-shell "$is_vim" "send-keys C-h" "select-pane -L"
bind-key -n M-j if-shell "$is_vim" "send-keys C-j" "select-pane -D"
bind-key -n M-k if-shell "$is_vim" "send-keys C-k" "select-pane -U"
bind-key -n M-l if-shell "$is_vim" "send-keys C-l" "select-pane -R"
bind-key -n M-\ if-shell "$is_vim" "send-keys C-\\" "select-pane -l"
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
bind-key -T copy-mode-vi M-\ select-pane -l
bind k selectp -U # switch to panel Up
bind j selectp -D # switch to panel Down
bind h selectp -L # switch to panel Left
bind l selectp -R # switch to panel Right
# Use vim caps for resizing.
bind H resize-pane -L 5
bind J resize-pane -D 5
bind K resize-pane -U 5
bind L resize-pane -R 5
# Remove confirmation before closing panels and windows.
bind-key x kill-pane
# Open new splits and windows in current panel path.
bind '"' split-window -c '#{pane_current_path}'
bind % split-window -h -c '#{pane_current_path}'
bind c new-window -c '#{pane_current_path}'
# Current path workaround for version older than 1.9
# set -g default-path "~"
# bind % set default-path "" \; split-window -h \; set -u default-path
# bind '"' set default-path "" \; split-window -v \; set -u default-path
# Zoom to a single panel with |.
bind | resize-pane -Z \; display-message 'Zooming panel'
set -g history-limit 10000 # increase scrollback
# Copy using Vim keys.
setw -g mode-keys vi
bind-key -t vi-copy 'v' begin-selection
bind-key -t vi-copy 'y' copy-pipe 'xclip -selection clipboard >/dev/null'
# Load specific settings for OSX.
if-shell 'test "$(uname)" = "Darwin"' 'source ~/.tmux-osx.conf'
# Reload the tmux config.
bind r source-file ~/.tmux.conf \; display 'tmux config reloaded!'