我已将 tmux 设置为 $TERM
并正确设置为 screen-256color
。这工作正常,并且颜色设置正确,但是它阻止我将 HOME
和 END
键发送到终端,而是打印为 F\n< /code> 和 H\n
。
我应该补充一点,home 似乎可以在 irssi 中运行,但不能在 vim 中运行。 Home似乎发送(根据Ctrl+v
),^[OH
可能值得补充的是,我很清楚使用的能力>^
和 $
移动到行的开头和结尾,但是 $
不会移动到末尾,而是移动到倒数第二个字符,我更喜欢使用 HOME
和END
(就像我可以在其他 $TERM 设置下一样)。
谁能解释这是为什么,以及我该如何解决它?
作为部分修复,我将 vim 键绑定设置为将
和
按键映射到 OH 和 <代码>OF。这并不理想,但目前有效!有关详细信息,请参阅 https://github.com/jvc26/dotfiles/blob/master/.vimrc 。
谢谢!
I have tmux set up with $TERM
being set to screen-256color
correctly. This works fine, and colours are set correctly, however it prevents me from sending HOME
and END
keys to the terminal, which are instead printed as F\n
and H\n
.
I should add that home appears to work in irssi, but not vim. Home seems to send (According to Ctrl+v <HOME>
), ^[OH
It may be worth adding that I am well aware of the ability to use ^
and $
to move to the start and end of the lines, however $
does not go to the end, rather the penultimate character, and I prefer to use HOME
and END
(as I can under other $TERM settings).
Can anyone explain why this is, and how I can fix it?
As a part-way fix, I set the vim keybindings to map a <Home>
and <End>
keypress to <Esc>OH
and <Esc>OF
. This isn't ideal, but works for the moment! See https://github.com/jvc26/dotfiles/blob/master/.vimrc for details.
Thanks!
发布评论
评论(3)
上述映射方案不影响命令模式或视觉模式。在 tmux 或 vim 修复 bug 之前,以下是更理想的解决方案(放入您的 .vimrc 中):
The above mapping solution doesn't affect the command mode or visual mode. The following is a more ideal solution until either tmux or vim fixes the bug (put in your .vimrc):
作为修复,我将 vim 键绑定设置为将
和
按键映射到OH
并OF
。As a fix, I set the vim keybindings to map a
<Home>
and<End>
keypress to<Esc>OH
and<Esc>OF
.也可以按照 archlinux .inputrc 中设置键绑定>Home_and_End_keys_not_working 或
.zshrc
如 zshwiki/zle/bindkeys。这个其他 stackoverflow 问题有一些额外的有用提示 home-end-keys-do -不在 tmux 中工作It is also possible to set the keybindings in the
.inputrc
as explained on archlinux Home_and_End_keys_not_working or.zshrc
as on zshwiki/zle/bindkeys. This other stackoverflow question has some additional useful tips home-end-keys-do-not-work-in-tmux