forked from wuzangsama/dotfile
-
Notifications
You must be signed in to change notification settings - Fork 0
/
tmux.conf
112 lines (86 loc) · 3.48 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
# 级别:
# 服务器
# ㄴ会话 Session
# ㄴ窗口 Window
# ㄴ面板 Pane
# 选项:
# - Session 选项 (set-option [-g])
# - Window 选项 (set-window-option [-g])
# -------------------------------------------------------------------
# Session 选项
# -------------------------------------------------------------------
# 修改绑定前缀健到ctrl-a
unbind-key c-b
set-option -g prefix c-a
# 索引从1开始
set-option -g base-index 1
set-option -g pane-base-index 1
# 关闭窗口时重新编号
set-option -g renumber-windows on
# 历史
set-option -g history-limit 102400
# 重复按键间隔时间,单位毫秒
set-option -g repeat-time 500
# 使tmux能显示256色
set-option -g default-terminal "screen-256color"
# Mac系统为了解决某些命令可能失效的问题,先安装brew install reattach-to-user-namespace
set-option -g default-command "reattach-to-user-namespace -l zsh"
# 增加truecolor支持 (tmux info | grep Tc)
set-option -ga terminal-overrides ",xterm-256color:Tc"
# 状态栏操作的键盘绑定
# set-option -g status-keys emacs
# 启用鼠标
set-option -g mouse on
# -------------------------------------------------------------------
# Window 选项
# -------------------------------------------------------------------
# 复制模式
set-window-option -g mode-keys vi
# -------------------------------------------------------------------
# 按键绑定
# -------------------------------------------------------------------
# prefix c 新建窗口
bind-key c new-window -c "#{pane_current_path}"
# prefix ctrl-a 上一次的窗口
bind-key c-a last-window
# prefix a
bind-key a send-prefix
# prefix | 纵向切分
bind-key | split-window -h -c "#{pane_current_path}"
# prefix - 横向切分
bind-key - split-window -c "#{pane_current_path}"
# 移动窗口
bind-key -r > swap-window -t :+
bind-key -r < swap-window -t :-
# 窗口切换
bind-key bspace previous-window
bind-key space next-window
bind-key / next-layout # Overridden
# 面板移动
bind-key h select-pane -L
bind-key l select-pane -R
bind-key j select-pane -D
bind-key k select-pane -U
bind-key tab select-pane -t :.+
bind-key btab select-pane -t :.-
# 在所有面板中执行相同的命令
bind-key * set-window-option synchronize-pane
# 重载配置文件
bind-key R source-file ~/.tmux.conf \; display-message "Reloaded!"
# Mac 清屏
bind-key C-l send-keys C-l \; clear-history
# -------------------------------------------------------------------
# 配色 (256-color)
# -------------------------------------------------------------------
set-option -g status-justify left
set-option -g status-left '#[bg=colour72] #[bg=colour237] #[bg=colour236] #[bg=colour235]#[fg=colour185] #h #[bg=colour236] '
set-option -g status-left-length 16
set-option -g status-bg colour237
set-option -g status-right '#[bg=colour236] #[bg=colour235]#[fg=colour185] #(date "+%a %b %d %H:%M") #[bg=colour236] #[bg=colour237] #[bg=colour72] '
set-option -g status-interval 60
set-option -g pane-border-status bottom
set-option -g pane-border-format "#{pane_index} #{pane_current_command}"
# set-option -g pane-active-border-fg colour245
# set-option -g pane-border-fg colour243
set-window-option -g window-status-format '#[bg=colour238]#[fg=colour107] #I #[bg=colour239]#[fg=colour110] #[bg=colour240]#W#[bg=colour239]#[fg=colour195]#F#[bg=colour238] '
set-window-option -g window-status-current-format '#[bg=colour236]#[fg=colour215] #I #[bg=colour235]#[fg=colour167] #[bg=colour234]#W#[bg=colour235]#[fg=colour195]#F#[bg=colour236] '