安装 tmux
sudo apt install tmux
安装 tmux 主题
cd ~
git clone https://github.com/gpakosz/.tmux.git
ln -s -f .tmux/.tmux.conf
cp .tmux/.tmux.conf.local .
安装 tmux 插件管理器
git clone https://github.com/tmux-plugins/tpm ~/.tmux/plugins/tpm
编辑配置文件 ~/.tmux.conf,在文件末尾添加:
# Last saved environment is automatically restored when tmux is started
set -g mouse on
set -g @continuum-restore 'on'
# Tmux is automatically started after the computer/server is turned on
set -g @continuum-boot 'on'
# Set the saving interval to 60 (minutes)
set -g @continuum-save-interval '60'
# Restoring bash history
set -g @resurrect-save-bash-history 'on'
# This plugin enables saving and restoring tmux pane contents
set -g @resurrect-capture-pane-contents 'on'
# for vim to save the session
set -g @resurrect-strategy-vim 'session'
# for neovim to save the session
set -g @resurrect-strategy-nvim 'session'
# List of plugins
set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'tmux-plugins/tmux-resurrect'
set -g @plugin 'tmux-plugins/tmux-continuum'
# Initialize TMUX plugin manager (keep this line at the very bottom of tmux.conf)
run '~/.tmux/plugins/tpm/tpm'
重新导入 tmux 配置环境
tmux
source ~/.tmux.conf
修改~/.bashrc 解决配色冲突
alias tmux="TERM=screen-256color-bce tmux"
安装插件使配置文件生效
tmux new -s tmp # 创建一个 tmux 会话
网友评论