我管理了几台Linux机器,其中一些在存储库中有tmux 2.1版本,另一些在tmux版本低于2.1的情况下.我使用鼠标模式,据我所知,在tmux 2.1中,启用鼠标模式的选项已更改为:
set -g mouse on
Run Code Online (Sandbox Code Playgroud)
由于我使用不同的发行版,每个发行版都有不同版本的tmux,我想制作一个.tmux.conf文件,根据版本启用相应的鼠标选项.
所以,我在.tmux.conf中添加了以下内容:
# Mouse Mode
if-shell "[[ `tmux -V |cut -d ' ' -f2` -ge 2.1 ]]" 'set -g mouse on'
if-shell "[[ `tmux -V |cut -d ' ' -f2` -lt 2.0 ]]" 'set -g mode-mouse on'
if-shell "[[ `tmux -V |cut -d ' ' -f2` -lt 2.0 ]]" 'set -g mouse-resize-pane on'
if-shell "[[ `tmux -V |cut -d ' ' -f2` -lt 2.0 ]]" 'set -g mouse-select-pane on'
if-shell "[[ `tmux -V …
Run Code Online (Sandbox Code Playgroud) tmux ×1