tmux不自动加载配置文件.tmux.conf

时间:2023-03-09 19:37:21
tmux不自动加载配置文件.tmux.conf
/**********************************************************************
* tmux不自动加载配置文件.tmux.conf
* 说明:
* 使用SSH连接服务器,只有一个窗口,使用起来比较麻烦,于是使用tmux来分屏,
* 结果写了tmux的配置,一直无效,原来是需要手动加载,尤其是第一次要手动加载一次,
* 在里面再加入自动加载的快捷键,这样就可以了。
*
* 2018-6-19 深圳 宝安西乡 曾剑锋
*********************************************************************/ 一、参考文档:
. tmux : config files are not used
https://*.com/questions/30558755/tmux-config-files-are-not-used
2. 自动安装Tmux,使用配置脚本
https://github.com/ZengjfOS/Tmux
二、解决方法:
. After you make changes to ~/.tmux.conf make sure tmux sources them with the tmux source-file ~/.tmux.conf shell command.
. bind R source-file ~/.tmux.conf ; display-message "Config reloaded.." 三、配置示例:
bind R source-file ~/.tmux.conf ; display-message "Config reloaded.." # set -g prefix C-a
# unbind C-b
# bind C-a send-prefix # Remap window(pane?) navigation to vim
# 用 vim 的方式在窗格间移动光标
unbind-key j
bind-key j select-pane -D
unbind-key k
bind-key k select-pane -U
unbind-key h
bind-key h select-pane -L
unbind-key l
bind-key l select-pane -R # 开启鼠标模式
set-option -g mouse on # 允许鼠标选择窗格
set -g mouse-select-pane on # Split tmux.conf into multiple files
# source-file ~/.tmux/mylayout # 默认分屏
selectp -t
splitw -h -p
selectp -t
splitw -v -p
selectp -t