tmux恢复窗口配置

16 篇文章 0 订阅

恢复窗口配置:

首先查看tmux版本:

tmux -V

resurrect插件需要tmux1.9以上的版本。如果你的版本低于1.9,那么升级是必须的,其实把tmux升级到1.9以上还是蛮推荐的。

这里推荐安装tpm (Tmux Plugin Manager)tmux插件管理,再通过tpm安装continuum等插件:

git clone https://github.com/tmux-plugins/tpm ~/.tmux/plugins/tpm

编辑~/.tmux.conf,在文件末尾加入以下几行:

# Set default shell to zsh
# set-option -g default-shell /bin/zsh

# Use the following line to fix OS X tmux problems
# set-option -g default-command "reattach-to-user-namespace -l zsh"

# List of plugins
set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'tmux-plugins/tmux-sensible'
set -g @plugin 'tmux-plugins/tmux-resurrect'
set -g @plugin 'tmux-plugins/tmux-continuum'

# 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'

# Enable automatic restore
set -g @continuum-restore 'on'

# Initialize TMUX plugin manager (keep this line at the very bottom of tmux.conf)
run '~/.tmux/plugins/tpm/tpm'

如果你的默认shell是zsh,请把这句的注释去掉:

set-option -g default-shell /bin/zsh

如果你用的是Mac OSX,把这句的注释也去掉:

set-option -g default-command "reattach-to-user-namespace -l zsh"

这主要是tmux在OSX下水土不服(更详细的问题描述可以看这篇文章:Reattach-to-user-namespace: The Fix for Your Tmux in OS X Woes),需要用reattach-to-user-namespace黑科技,所以你最好也用MacPorts或者Homebrew装下这个工具:

port install tmux-pasteboard
brew install reattach-to-user-namespace

在终端下执行以下命令更新tmux配置,运行tpm

tmux source ~/.tmux.conf

最后在tmux下运行prefix + I(如果你没改键绑定的话就是<Ctrl>-b + <Shift>-i)安装插件。你还可以通过prefix + U<Ctrl>-b + <Shift>-u)更新插件,用prefix + <Alt> + u删除插件。

安装完成之后,你可以在~/.tmux/plugins/里找到每个插件的代码目录。resurrect插件还有一个run_tests脚本用于检查是否安装正确,不过要运行这个脚本需要装上虚拟化神器vagrant

如果安装正确,continuum插件会每隔15分钟产生一份备胎,我们也可以用prefix + <Ctrl>-s手动备份,用prefix + <Ctrl>-r手动恢复.

参考链接:

http://blog.csdn.net/robertbaker/article/details/42172203

https://segmentfault.com/a/1190000006232298



<code><span class="pln"><span style="font-size: 14px;">
</span></span></code>
  • 1
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值