#-- base settings --# set -g default-terminal "screen-256color" set -g display-time 3000 set -g escape-time 0 set -g history-limit 65535 set -g base-index 1 set -g pane-base-index 1 #-- bindkeys --#
# prefix key (Ctrl+x) set -g prefix ^x unbind ^b # bind a send-prefix #up bind-key k select-pane -U #down bind-key j select-pane -D #left bind-key h select-pane -L #right bind-key l select-pane -R #select last window bind-key C-l select-window -l #copy-mode 将快捷键设置为vi 模式 setw -g mode-keys vi # zoom pane <-> window #http://tmux.svn.sourceforge.net/viewvc/tmux/trunk/examples/tmux-zoom.sh bind ^z run "tmux-zoom" ##
改变配置文件 ~/.tmux.conf后,重启tmux,发现无效。
原来tmux有个服务进程,客户进程重启时不会解析配置。
可以:
tmux kill-server
或者:
tmux source-file ~/.tmux.conf
或者在tmux中:
C-b :source-file ~/.tmux.conf
概述
tmux 用了很长时间了, 快捷键定制了不少, 唯一的遗憾是没法保存 session, 每次关机重开之后, 恢复不到之前的 tmux session. 虽然也能忍受, 但是每天都手动打开之前的 session, 总觉得有些麻烦, 直到找到了 tmux-resurrect
tmux-resurrect 可以方便的保存和恢复 tmux session.
安装
可以直接安装, 也可以通过 tpm 来安装, tpm(tmux package management)可以非常方便的安装和卸载 tmux plugin
tpm 安装
tpm 路径: https://github.com/tmux-plugins/tpm
$ git clone https://github.com/tmux-plugins/tpm ~/.tmux/plugins/tpm
复制如下内容到 ~/.tmux.conf
# List of plugins
set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'tmux-plugins/tmux-sensible'
# Initialize TMUX plugin manager (keep this line at the very bottom of tmux.conf)
run -b '~/.tmux/plugins/tpm/tpm'
重启 tmux 之后, 就安装完成了
tmux-resurrect 安装
在上面的 #List of plugins 下面添加 tmux-resurrect plugin
# List of plugins
set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'tmux-plugins/tmux-sensible'
set -g @plugin 'tmux-plugins/tmux-resurrect' # <-- 这个是新添加的
重启 tmux 之后, 输入 prefix + I, 就会自动安装 plugin
使用
tmux-resurrect 的使用非常简单, 默认的保存和恢复 session 的快捷键如下:
prefix + Ctrl-s Save
prefix + Ctrl-r Restore
my ~tmux.conf
来自
标签:
发表回复