-
Notifications
You must be signed in to change notification settings - Fork 0
/
.tmux.conf
102 lines (84 loc) · 4.32 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
# ==========================================
# Tmux conf
# Last_modify: 2017-04-24
# ==========================================
# ==========================================
# 注意:如果使用XShell, 需要设置终端的键盘为ASCII 127,否则backspace工作会异常
# ==========================================
# --------------------------- base config begin -------------------------------
# 全局设置
set-window-option -g xterm-keys on
set-window-option -g display-panes-time 1500
set-option -g default-terminal "xterm-256color" # use 256 colors
set-option -g history-limit 100000 # scrollback buffer n lines
set-option -g display-time 5000 # 提示信息的持续时间;设置足够的时间以避免看不清提示,单位为毫秒
set-option -g set-titles on # set-option terminal title
set-option -g set-titles-string '#h ❐ #S ● #I #W'
set-window-option -g monitor-activity on
set-option -g visual-activity on
# bind-key a reload key: prefix+r
bind-key R source-file ~/.tmux.conf \; display-message "Config reloaded.."
# -------------------------------- pane begin --------------------------------
# 窗口间切换
# [prefix-hjkl] pane之间移动
unbind-key h
bind-key h select-pane -L
unbind-key j
bind-key j select-pane -D
unbind-key k
bind-key k select-pane -U
unbind-key l
bind-key l select-pane -R
# smart pane switching with awareness of vim splits
# [Ctrl-hjkl] pane之间移动
bind-key -n C-h run "(tmux display-message -p '#{pane_current_command}' | grep -iqE '(^|\/)vim$' && tmux send-keys C-h) || tmux select-pane -L"
bind-key -n C-j run "(tmux display-message -p '#{pane_current_command}' | grep -iqE '(^|\/)vim$' && tmux send-keys C-j) || tmux select-pane -D"
bind-key -n C-k run "(tmux display-message -p '#{pane_current_command}' | grep -iqE '(^|\/)vim$' && tmux send-keys C-k) || tmux select-pane -U"
bind-key -n C-l run "(tmux display-message -p '#{pane_current_command}' | grep -iqE '(^|\/)vim$' && tmux send-keys C-l) || tmux select-pane -R"
# 窗口大小调整
# resize panes using PREFIX H, J, K, L
bind-key H resize-pane -L 5
bind-key J resize-pane -D 5
bind-key K resize-pane -U 5
bind-key L resize-pane -R 5
# -------------------------------- pane end --------------------------------
# -------------------------------- move/copy/paste begin --------------------------------
# use vi mode
set-window-option -g mode-keys vi
#Comment all of vi-copy binding because of Tmux 2.4 compatibility change.
#Just use Space for begin-selection, use q for cancel.
#for Tmux 2.3-
#bind-key -t vi-copy v begin-selection
#bind-key -t vi-copy C-v rectangle-toggle
#bind-key -t vi-copy y copy-selection
#bind-key -t vi-copy Escape cancel
#bind-key -t vi-copy H start-of-line
#bind-key -t vi-copy L end-of-line
#for Tmux 2.4+
#bind-key -Tcopy-mode-vi v send -X begin-selection
#bind-key -Tcopy-mode-vi C-v send -X rectangle-toggle
#bind-key -Tcopy-mode-vi y send -X copy-selection
#bind-key -Tcopy-mode-vi Escape send -X clear-selection
#bind-key -Tcopy-mode-vi H send -X top-line
#bind-key -Tcopy-mode-vi L send -X bottom-line
# -------------------------------- move/copy/paste end --------------------------------
# -------------------------------- status line begin --------------------------------
# 窗口列表
set-window-option -g automatic-rename on
# powerline stype statusline
set-option -g status-left-length 32
set-option -g status-right-length 150
set-option -g status-fg white
set-option -g status-bg colour234
set-option -g window-status-activity-attr bold
set-option -g pane-border-fg colour245
set-option -g pane-active-border-fg colour39
set-option -g message-fg colour16
set-option -g message-bg colour221
set-option -g message-attr bold
set-option -g status-left '#[fg=colour235,bg=colour252,bold] ❐ #S #[fg=colour252,bg=colour238,nobold]#[fg=colour245,bg=colour238,bold] #(whoami) #[fg=colour238,bg=colour234,nobold]'
set-option -g window-status-format "#[fg=white,bg=colour234] #I #W "
set-option -g window-status-current-format "#[fg=colour234,bg=colour39]#[fg=colour25,bg=colour39,noreverse,bold] #I: #W #[fg=colour39,bg=colour234,nobold]"
set-option -g status-right '#[fg=colour235,bg=colour252,bold] #H [%Y-%m-%d %H:%M]'
# -------------------------------- status line end --------------------------------
# --------------------------- base config end -------------------------------