bind-key c new-window -c "#{pane_current_path}"
bind-key % split-window -h -c "#{pane_current_path}"
bind-key '"' split-window -c "#{pane_current_path}"
set -g default-terminal "tmux-256color"
set-option -g mouse on 
bind -r k select-pane -U 
bind -r j select-pane -D 
bind -r h select-pane -L 
bind -r l select-pane -R 
# c-a
set -g prefix C-a 
unbind C-b 
bind C-a send-prefix 
#
# List of plugins
set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'tmux-plugins/tmux-sensible'
set -g @plugin 'tmux-plugins/tmux-yank'
set -g @plugin 'tmux-plugins/tmux-resurrect'
set -g @plugin 'tmux-plugins/tmux-continuum'
set -g @continuum-save-interval '30'
set -g @resurrect-dir '~/.tmux/resurrect'
# Other examples:
# set -g @plugin 'github_username/plugin_name'
# set -g @plugin 'git@github.com/user/plugin'
# set -g @plugin 'git@bitbucket.com/user/plugin'
# Initialize TMUX plugin manager (keep this line at the very bottom of tmux.conf)
run -b '~/.tmux/plugins/tpm/tpm'

快捷键换绑

在使用vim时常常为无鼠标操作。由于C-b的跨度过大,而且部分常用快捷键用起来并不顺手,因此对快捷键进行了换绑,以及增添了新快捷键。

bink-key c new-window -c “#{pane_current_path}”是将<prefix> C-c绑定为new-window-c 参数和“#{pane_current_path}”意为将新打开的window的路径设置为当前路径。

set-option -g mouse on 设置允许使用鼠标操作,虽然绝大多数情况下为无鼠标操作,但是开启此设置可以让鼠标操作更方便,同时也可以与插件tmux-yank 搭配使用,更加灵活

bind -r k select -pane -U 更换了tmux中上下左右快捷键,绑定为了hjkl,符合vim习惯

set -g prefix C-a 
unbind C-b 
bind C-a send-prefix 

这三行代码对prefix 进行了换绑,绑定为了C-a

设置terminal

set -g default-terminal "tmux-256color"设置terminal支持256色,否则设置的颜色主题Solarized会有显示问题。

设置插件

使用tpm安装插件的方法是:

  1. ~/.vim.conf文件中添加想要使用的插件,使用代码set -g @plugin ‘tmux-plugins/xxx’
  2. 保存文件,并使用tmux source ~/.vim.conf 命令使配置生效
  3. 使用快捷键<prefix> C-I 下载插件,等待片刻后便会有反馈信息

我这里启用的插件为