-
-
Notifications
You must be signed in to change notification settings - Fork 157
Expand file tree
/
Copy path.tmux.conf
More file actions
125 lines (103 loc) · 3.82 KB
/
Copy path.tmux.conf
File metadata and controls
125 lines (103 loc) · 3.82 KB
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
# 配置 24-bit True-color(Tc), more info in this PR:
# https://github.com/tmux/tmux/pull/112
set -g default-terminal "tmux-256color"
set-option -ga terminal-overrides ",*256col*:Tc" # 这句是关键
# 配置使用ctrl+g作为命令引导键(默认为ctrl+a)
set -g prefix C-g
# Set default shell to zsh
set-option -g default-shell /bin/zsh
#
# 设置窗口分割的边框颜色
# set -g pane-border-fg colour189
# set -g pane-border-bg black
# 设置当前窗口分割的边框颜色
# set -g pane-active-border-fg white
# set -g pane-active-border-bg colour208
#
# this option is only available in tmux 2.1+
if-shell '[[ `tmux -V | cut -d" " -f2` == 2.1 ]] || [[ `tmux -V | cut -d" " -f2` > 2.1 ]]' \
"set-window-option -g mouse on"
# 窗口信息居中显示
set -g status-justify centre
# 监视窗口信息,如有内容变动,进行提示
setw -g monitor-activity on
set -g visual-activity on
# 窗口号和窗口分割号都以1开始(默认从0开始)
set -g base-index 1
setw -g pane-base-index 1
# 支持鼠标选择窗口,调节窗口大小
set -g mouse on
set -s escape-time 1
set -g renumber-windows on
# 设置C-a a为发送C-a键
bind a send-prefix
# 加载tmux配置文件的快捷键
bind r source-file ~/.tmux.conf\; display "Reloaded!"
# 快捷键查看man
bind / command-prompt "split-window 'exec man %%'"
unbind "%"
unbind "\""
# 修改默认的窗口分割快捷键,使用更直观的符号
bind | split-window -h
bind - split-window -v
# 选择窗口功能修改为和Screen一样的C-a "
bind "\"" choose-window
# 选择窗口分割快捷键
bind h select-pane -L
bind j select-pane -D
bind k select-pane -U
bind l select-pane -R
# 选择窗口快捷键
bind -r C-h select-window -t :-
bind -r C-l select-window -t :+
# 调节窗口大小快捷键
bind -r H resize-pane -L 3
bind -r J resize-pane -D 3
bind -r K resize-pane -U 3
bind -r L resize-pane -R 3
# 快捷记录窗口内的内容到文件中
bind P pipe-pane -o "cat >>~/#W.log" \; display "Toggled logging to ~/#W.log"
# Use vim keybindings in copy mode
setw -g mode-keys vi
# Setup 'v' to begin selection as in Vim
# Make sure you have the "Applications in terminal may access clipboard" option set when using iTerm2
bind-key -Tcopy-mode-vi 'v' send -X begin-selection
bind-key -Tcopy-mode-vi 'y' send -X copy-selection
# auto naming
set -g allow-rename off
set -g automatic-rename on
set -g automatic-rename-format '#{b:pane_current_path}'
# Setup ydict
bind-key -T copy-mode-vi Enter send-keys -X copy-pipe-and-cancel "xargs -I {} tmux run-shell -b 'ydict -q {}'"
# List olugins
set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'tmux-plugins/tmux-resurrect'
set -g @plugin 'tmux-plugins/tmux-sensible'
set -g @plugin 'tmux-plugins/tmux-yank'
set -g @plugin 'tmux-plugins/tmux-continuum'
set -g @plugin 'catppuccin/tmux#v2.1.3'
set -g @plugin 'tmux-plugins/tmux-battery'
set -g @plugin 'tmux-plugins/tmux-cpu'
# Catppuccin options must be set before TPM loads plugins.
set -g @catppuccin_flavor 'mocha' # latte, frappe, macchiato or mocha
set -g @catppuccin_window_status_style 'rounded'
set -g @catppuccin_window_text " #W"
set -g @catppuccin_window_current_text " #W"
# Show status bar on the top
set -g status-position top
set -g status-left-length 100
set -g status-right-length 100
set -g status-left ""
set -g status-right "#{E:@catppuccin_status_application}"
set -agF status-right "#{E:@catppuccin_status_cpu}"
set -ag status-right "#{E:@catppuccin_status_session}"
set -ag status-right "#{E:@catppuccin_status_uptime}"
set -agF status-right "#{E:@catppuccin_status_battery}"
# Initializes TPM plugin manager.
# Keep this line at the very bottom of tmux.conf.
run '~/.tmux/plugins/tpm/tpm'
# 快捷调整窗口分割到全屏
unbind u
bind u new-window -d -n tmp \; swap-pane -s tmp.1 \; select-window -t tmp
unbind n
bind n last-window \; swap-pane -s tmp.1 \; kill-window -t tmp