linux - 在 tmux 显示消息中显示选项的当前值

标签 linux configuration configuration-files tmux

我在我的 tmux 配置中为 synchronize-panes 窗口选项绑定(bind)了一个键。我还想用相同的按键显示相同选项的当前状态。到目前为止,我已经尝试过:

# one or more of the following
bind-key S run-shell "tmux setw synchronize-panes; TMUX_STATUS=`tmux showw synchronize-panes`;tmux display-message $TMUX_STATUS"
bind-key S "setw synchronize-panes; display-message `showw synchronize-panes`"
bind-key S run-shell "tmux setw synchronize-panes; TMUX_STATUS=$(tmux showw synchronize-panes); tmux display-message $TMUX_STATUS"

最佳答案

您可以通过 .tmux.conf 中的以下绑定(bind)实现这一点

使用 tmux 2.4 测试

# Toggle synchronize-panes with ^S m
bind S \
    set synchronize-panes \;\
    display "Sync #{?synchronize-panes,ON,OFF}"

您在手册页中有关于 tmux 变量和格式的详细信息。 https://www.systutorials.com/docs/linux/man/1-tmux/

关于linux - 在 tmux 显示消息中显示选项的当前值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43439551/

相关文章:

java - 如何使用 libhdfs.so 获取 hdfs 配置信息

php - 登录 phpMyAdmin 时出现错误 2002

python - 在 Python 中自动读取配置值

java - 如何以编程方式为 hadoop *-site.xml 设置目录

linux - 关于 Linux 和 Windows 中的死锁

ruby-on-rails - 带 puma 和 nginx systemd 的 Rails 5

eclipse - Tomcat 7 在使用 Eclipse 时覆盖了 tomcat-users.xml

java - 尝试压缩 else if 语句

linux - Bash - 损坏的符号链接(symbolic link)

linux - 用两条新线替换一条线