解除所有tmux前缀键的绑定

发布于 2025-01-20 23:33:52 字数 767 浏览 3 评论 0原文

如何解除tmux中默认前缀键的绑定?

  • 我的意思是用户设置的默认值,不一定是Cb

  • 我不知道用户设置了什么!所以我必须用命令发现前缀

  • 解决方案应该在zsh文件中而不是在.tmux.conf中

  • 使用 tmux 命令优先于正则表达式

来获取默认前缀键,

$ tmux send-prefix
^[w

当我将 send-prefix 输出传输到 tmux unbind 命令时,输出为如下

$ tmux send-prefix | xargs tmux unbind
^[`missing key

如果命令返回Mq,我可以按以下方式取消绑定(但不返回)

a_command | xargs tmux unbind

其他方法是使用正则表达式进行以下输出(但如何?)

$ tmux list-keys | grep send-prefix
bind-key    -T prefix       M-q                  send-prefix

请帮助我...

How can unbind default prefix key in tmux?

  • I mean the default set by the user, Not necessarily C-b

  • I do not know what the user has set! So I have to discover the prefix with the command

  • solution should be in the zsh file and not in .tmux.conf

  • use tmux command takes precedence over Regex

for getting default prefix key I use

$ tmux send-prefix
^[w

when I pipe send-prefix output to tmux unbind command, the output is as follows

$ tmux send-prefix | xargs tmux unbind
^[`missing key

if the command return M-q, I can unbind as following (but not return)

a_command | xargs tmux unbind

Other way is to use Regex for following output (but how?)

$ tmux list-keys | grep send-prefix
bind-key    -T prefix       M-q                  send-prefix

please help me...

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

平生欢 2025-01-27 23:33:52

例如,在 .tmux.conf 中:

# remap prefix from CTRL-B to CTRL+Spacebar                                                                                                           
set -g prefix C-Space                                                                                                                                     
unbind C-b

For example, in the .tmux.conf:

# remap prefix from CTRL-B to CTRL+Spacebar                                                                                                           
set -g prefix C-Space                                                                                                                                     
unbind C-b
甜尕妞 2025-01-27 23:33:52

通过使用awk解决了!

unbind prefix key

$ tmux list-keys | grep send-prefix 
bind-key    -T prefix       M-q                  send-prefix

$ tmux list-keys | grep send-prefix | awk '{print $4}'
M-q

$ tmux list-keys | grep send-prefix | awk '{print $4}' | xargs tmux unbind

unbind prefix2 key

$ tmux show-options -g | grep prefix2
prefix2 M-t

$ tmux show-options -g | grep prefix2 | awk '{print $2}'
M-t

$ tmux show-options -g | grep prefix2 | awk '{print $2}' | xargs tmux unbind

if have multi output we can iterate by piping to while

tmux list-keys | grep send-prefix | awk '{print $4}' |  while prefix_key line; do
    tmux unbind $prefix_key
done

(Similarly for prefix2)

Solved, by using awk!

unbind prefix key

$ tmux list-keys | grep send-prefix 
bind-key    -T prefix       M-q                  send-prefix

$ tmux list-keys | grep send-prefix | awk '{print $4}'
M-q

$ tmux list-keys | grep send-prefix | awk '{print $4}' | xargs tmux unbind

unbind prefix2 key

$ tmux show-options -g | grep prefix2
prefix2 M-t

$ tmux show-options -g | grep prefix2 | awk '{print $2}'
M-t

$ tmux show-options -g | grep prefix2 | awk '{print $2}' | xargs tmux unbind

if have multi output we can iterate by piping to while

tmux list-keys | grep send-prefix | awk '{print $4}' |  while prefix_key line; do
    tmux unbind $prefix_key
done

(Similarly for prefix2)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文