Skip to content

Instantly share code, notes, and snippets.

@ls0f
Created January 20, 2016 07:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ls0f/6c7a07acf7778e38914d to your computer and use it in GitHub Desktop.
Save ls0f/6c7a07acf7778e38914d to your computer and use it in GitHub Desktop.
tmux config
#此类配置可以在命令行模式中输入show-options -g查询
set-option -g base-index 1 #窗口的初始序号;默认为0,这里设置为1
set-option -g display-time 5000 #提示信息的持续时间;设置足够的时间以避免看不清提示,单位为毫秒
set-option -g repeat-time 1000 #控制台激活后的持续时间;设置合适的时间以避免每次操作都要先激活控制台,单位为毫秒
set-option -g status-keys vi #操作状态栏时的默认键盘布局;可以设置为vi或emacs
set-option -g status-right "#(date +%H:%M' ')" #状态栏右方的内容;这里的设置将得到类似23:59的显示
set-option -g status-right-length 10 #状态栏右方的内容长度;建议把更多的空间留给状态栏左方(用于列出当前窗口)
#set-option -g status-utf8 on 开启状态栏的UTF-8支持
#此类设置可以在命令行模式中输入show-window-options -g查询
set-window-option -g mode-keys vi #复制模式中的默认键盘布局;可以设置为vi或emacs
set-window-option -g utf8 on #开启窗口的UTF-8支持
#将激活控制台的快捷键由Ctrl+b修改为Ctrl+a
set-option -g prefix C-a
#unbind-key C-b
bind-key C-a send-prefix
#添加自定义快捷键
bind-key z kill-session #按z结束当前会话;相当于进入命令行模式后输入kill-session
bind-key h select-layout even-horizontal #按h将当前面板布局切换为even-horizontal;相当于进入命令行模式后输入select-layout even-horizontal
bind-key v select-layout even-vertical #按v将当前面板布局切换为even-vertical;相当于进入命令行模式后输入select-layout even-vertical
setw -g mode-keys vi
# 复制到系统粘贴板
set-option -g default-command "reattach-to-user-namespace -l zsh"
# start selecting text typing 'v' key (once you are in copy mode)
bind-key -t vi-copy v begin-selection
# # copy selected text to the system's clipboard
bind-key -t vi-copy y copy-pipe "reattach-to-user-namespace pbcopy"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment