使 Alt + h 切换到 Tmux 中的左窗格 [英] Make Alt + h switch to the left pane in Tmux

查看:32
本文介绍了使 Alt + h 切换到 Tmux 中的左窗格的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试让 Alt-h 切换到 Tmux 的左侧窗格.这不起作用:

I'm trying to make Alt-h switch to the left pane in Tmux. This does not work:

bind -n M-h select-pane -L

cat 中按 Alt-h 在我的终端中生成以下输出:

Pressing Alt-h in cat generates the following output in my terminal:

$ cat
^[h

也就是说,看起来 Alt 在我的终端中生成了 ^[.所以,在我的 Tmux 配置中,我也尝试过这种绑定:

That is, it looks like Alt generates ^[ in my terminal. So, in my Tmux configuration, I have also tried this binding:

bind -n ^[h select-pane -L

我已经将 "^[" 既是两个字面的字符串(即 "^" + "["),又是你可以在 Vim 中访问的特殊 "^[" 字符.都不行.

I have made "^[" both a literal two character string (i.e., "^" + "[") as well as the special "^[" character you can access in Vim. Neither work.

如何解决这个问题?

我主要使用 xfce4-terminal 作为我的终端模拟器,但我已经尝试使用 gnome-terminal 和 xterm,但问题仍然存在.

I'm primarily using xfce4-terminal as my terminal emulator, but I've tried using gnome-terminal as well as xterm, and the problem persists.

推荐答案

其实秘密在于你如何输入 ^[ ;-)

Actually the secret is how you enter ^[ ;-)

我假设你想编辑你的 .vimrc

I assume you want to edit your .vimrc

vim ~/.vimrc

  • 导航到正确的位置
  • i
  • ctrl-v
  • ctrl-[(在德语键盘上我必须按 ctrl-altgr-8 因为 altgr-8[)
    • navigate to the correct position
    • press i
    • press ctrl-v
    • press ctrl-[ (on a german keyboard I have to press ctrl-altgr-8 because altgr-8 is [)
    • 之后,您应该生成编写绑定所需的转义序列.

      After that you should have the escape sequence generated required to write the binding.

      这篇关于使 Alt + h 切换到 Tmux 中的左窗格的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆