-
Notifications
You must be signed in to change notification settings - Fork 0
/
dot_tmux.conf
114 lines (93 loc) · 3.56 KB
/
dot_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
# Set the default terminal mode to 256color mode
set -g default-terminal "screen-256color"
# Setting the prefix to C-b
set -g prefix `
# Unbind original prefix
unbind C-b
bind-key ` send-prefix
# Splitting panes
unbind %
bind-key \\ split-window -h -c "#{pane_current_path}"
unbind '"'
bind-key - split-window -v -c "#{pane_current_path}"
# New window in current directory
unbind c
bind-key c new-window -c "#{pane_current_path}"
# Reload tmux config
unbind r
bind-key r source-file ~/.tmux.conf
# Pane resizing
bind-key -r j resize-pane -D 5
bind-key -r k resize-pane -U 5
bind-key -r l resize-pane -R 5
bind-key -r h resize-pane -L 5
# bind -r m resize-pane -Z
bind-key ` last-window
# 解除原本的 prefix + [ 和 ; 的綁定
unbind [
# 設置 prefix + ; 為進入 Copy Mode 的快捷鍵
bind-key ';' copy-mode
setw -g mode-keys vi
# v 開始選取
bind-key -T copy-mode-vi v send-keys -X begin-selection
# y 結束選取並複製
bind-key -T copy-mode-vi y send-keys -X copy-selection \; send-keys -X clear-selection \;
# anti default-terminal "screen-256color"
bind-key -n C-a send "\e[1~" # move cursor beginning-of-line
bind-key -n C-e send "\e[4~" # move cursor end-of-line
#setting the delay between prefix and command
set -sg escape-time 0
# Set the base index for windows to 1 instead of 0
set -g base-index 1
# Set the base index for panes to 1 instead of 0
setw -g pane-base-index 1
# mouse support - set to on if you want to use the mouse
set -g mouse off
# TMP plugin
set -g @plugin 'tmux-plugins/tpm'
# List of plugins
set -g @plugin 'christoomey/vim-tmux-navigator'
# Smart pane switching with awareness of Vim splits.
# See: https://github.com/christoomey/vim-tmux-navigator
is_vim="ps -o state= -o comm= -t '#{pane_tty}' \
| grep -iqE '^[^TXZ ]+ +(\\S+\\/)?g?(view|l?n?vim?x?|fzf)(diff)?$'"
bind-key -n 'C-h' if-shell "$is_vim" 'send-keys C-h' 'select-pane -L'
bind-key -n 'C-j' if-shell "$is_vim" 'send-keys C-j' 'select-pane -D'
bind-key -n 'C-k' if-shell "$is_vim" 'send-keys C-k' 'select-pane -U'
bind-key -n 'C-l' if-shell "$is_vim" 'send-keys C-l' 'select-pane -R'
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
# Initialize TMUX plugin manager (keep this line at the very bottom of tmux.conf)
run '~/.tmux/plugins/tpm/tpm'
# set the status line's colors
# START:statuscolor
set -g status-fg white
set -g status-bg black
# END:statuscolor
# set the color of the window list
# START:windowstatuscolor
set-window-option -g window-status-style fg=cyan
set-window-option -g window-status-style bg=default
set-window-option -g window-status-style dim
# END:windowstatuscolor
# set colors for the active window
# START:activewindowstatuscolor
set-window-option -g window-status-current-style fg=white
set-window-option -g window-status-current-style bg=red
set-window-option -g window-status-current-style bright
# END:activewindowstatuscolor
# pane colors
# START:panecolors
set -g pane-border-style fg=green
set -g pane-border-style bg=black
set -g pane-active-border-style fg=black
set -g pane-active-border-style bg=green
# END:panecolors