-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.tmux.conf
153 lines (117 loc) · 5.26 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
142
143
144
145
146
147
148
149
150
151
152
# -- general -------------------------------------------------------------------
set -g default-terminal "screen-256color" # colors!
setw -g xterm-keys on
set -s escape-time 10 # faster command sequences
set -sg repeat-time 600 # increase repeat timeout
set -q -g status-utf8 on # expect UTF-8 (tmux < 2.2)
setw -q -g utf8 on
# display-----------------
set -g status-interval 10 # redraw status line every 10 seconds
set -g mouse on
set -g focus-events on
setw -g window-status-current-style fg=black,bg=yellow
set -g prefix C-x
unbind C-b
bind-key C-x send-prefix
bind-key c new-window -c "#{pane_current_path}"
bind-key % split-window -h -c "#{pane_current_path}"
bind-key '"' split-window -v -c "#{pane_current_path}"
set -g history-limit 65535
set -g base-index 1
set -g pane-base-index 1
set -g renumber-windows on
# split window
unbind '"'
# vertical split (prefix -)
bind - splitw -v
unbind %
bind | splitw -h # horizontal split (prefix |)
# swap pane
# swap with the previous pane (prefix Ctrl+u)
bind ^u swapp -U
# swap with the next pane (prefix Ctrl+d)
bind ^d swapp -D
# copy-mode 将快捷键设置为vi 模式
setw -g mode-keys vi
# window navigation
# unbind n
# unbind p
# bind C-j previous-window # select previous window
# bind C-k next-window # select next window
bind Tab last-window # move to last active window
# switch panes using Alt-arrow without prefix
bind -n M-Left select-pane -L
bind -n M-Right select-pane -R
bind -n M-Up select-pane -U
bind -n M-Down select-pane -D
# -- list choice (tmux < 2.4) --------------------------------------------------
# vi-choice is gone in tmux >= 2.4
run -b 'tmux bind -t vi-choice h tree-collapse 2> /dev/null || true'
run -b 'tmux bind -t vi-choice l tree-expand 2> /dev/null || true'
run -b 'tmux bind -t vi-choice K start-of-list 2> /dev/null || true'
run -b 'tmux bind -t vi-choice J end-of-list 2> /dev/null || true'
run -b 'tmux bind -t vi-choice H tree-collapse-all 2> /dev/null || true'
run -b 'tmux bind -t vi-choice L tree-expand-all 2> /dev/null || true'
run -b 'tmux bind -t vi-choice Escape cancel 2> /dev/null || true'
#up
bind-key k select-pane -U
#down
bind-key j select-pane -D
#left
bind-key h select-pane -L
#right
bind-key l select-pane -R
#resize pane
bind -r ^K resizep -U 10 # upward (prefix Ctrl+k)
bind -r ^J resizep -D 10 # downward (prefix Ctrl+j)
bind -r ^H resizep -L 10 # to the left (prefix Ctrl+h)
bind -r ^L resizep -R 10 # to the right (prefix Ctrl+l)
# reload config (prefix r)
bind r source ~/.tmux.conf \; display "Configuration reloaded!"
# -- copy mode -----------------------------------------------------------------
bind Enter copy-mode # enter copy mode
run -b 'tmux bind -t vi-copy v begin-selection 2> /dev/null || true'
run -b 'tmux bind -T copy-mode-vi v send -X begin-selection 2> /dev/null || true'
run -b 'tmux bind -t vi-copy C-v rectangle-toggle 2> /dev/null || true'
run -b 'tmux bind -T copy-mode-vi C-v send -X rectangle-toggle 2> /dev/null || true'
run -b 'tmux bind -t vi-copy y copy-selection 2> /dev/null || true'
run -b 'tmux bind -T copy-mode-vi y send -X copy-selection-and-cancel 2> /dev/null || true'
run -b 'tmux bind -t vi-copy Escape cancel 2> /dev/null || true'
run -b 'tmux bind -T copy-mode-vi Escape send -X cancel 2> /dev/null || true'
run -b 'tmux bind -t vi-copy H start-of-line 2> /dev/null || true'
run -b 'tmux bind -T copy-mode-vi H send -X start-of-line 2> /dev/null || true'
run -b 'tmux bind -t vi-copy L end-of-line 2> /dev/null || true'
run -b 'tmux bind -T copy-mode-vi L send -X end-of-line 2> /dev/null || true'
# copy to Mac OSX clipboard
if -b 'command -v reattach-to-user-namespace > /dev/null 2>&1' 'bind y run -b "tmux save-buffer - | reattach-to-user-namespace pbcopy"'
# copy to X11 clipboard
if -b 'command -v xsel > /dev/null 2>&1' 'bind y run -b "tmux save-buffer - | xsel -i -b"'
if -b '! command -v xsel > /dev/null 2>&1 && command -v xclip > /dev/null 2>&1' 'bind y run -b "tmux save-buffer - | xclip -i -selection clipboard >/dev/null 2>&1"'
# copy to Windows clipboard
if -b 'command -v clip.exe > /dev/null 2>&1' 'bind y run -b "tmux save-buffer - | clip.exe"'
if -b '[ -c /dev/clipboard ]' 'bind y run -b "tmux save-buffer - > /dev/clipboard"'
# -- buffers -------------------------------------------------------------------
bind C-b list-buffers # list paste buffers
bind C-p paste-buffer # paste from the top paste buffer
bind C-P choose-buffer # choose which buffer to paste from
# -- UI look-------------------------------------------------------
# clock mode
setw -g clock-mode-colour colour2
# pane borders
set -g pane-border-style 'fg=colour8'
set -g pane-active-border-style 'fg=colour2'
# statusbar
set -g status-position bottom
set -g status-justify left
set -g status-style 'fg=colour2'
set -g status-left ''
set -g status-right '#h %Y-%m-%d %H:%M '
# set -g status-right-length 50
set -g status-left-length 10
# Set different background color for active window
# setw -g window-status-current-bg magenta
# setw -g window-status-current-style 'fg=colour0 bg=colour1 bold'
# setw -g window-status-current-format ' #I #W #F '
# setw -g window-status-style 'fg=colour1 dim'
# setw -g window-status-format ' #I #[fg=colour7]#W #[fg=colour1]#F '
# setw -g window-status-bell-style 'fg=colour2 bg=colour1 bold'