随着$ TERM =下TMUX'屏幕256color',Home和End键不起作用。为什么? [英] With $TERM='screen-256color' under tmux, HOME and END keys don't work. Why?

查看:214
本文介绍了随着$ TERM =下TMUX'屏幕256color',Home和End键不起作用。为什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我TMUX设置了 $ TERM 被设置为屏幕256color 正确。这工作得很好,和颜色设置正确,但它prevents我发送首页 END 键终端,这是不是打印为˚F\\ n ^ h \\ n

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.

我要补充一点,家里出现在IRSSI工作,但没有活力。主页似乎发送(据 CTRL + V< HOME> ), ^ [OH

I should add that home appears to work in irssi, but not vim. Home seems to send (According to Ctrl+v <HOME>), ^[OH

这可能是值得补充说,我很清楚的使用 ^ $ 移至能力开始和线条的结尾,然而 $ 没有走到最后,而倒数第二的性格,我preFER使用 HOME END (因为我可以在其他$ TERM设置)。

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?

,我设置了vim的键绑定映射一个&LT;家&GT; &LT;末&GT; 键preSS为&LT; ESC&GT; OH &LT; ESC&gt;将。这是不理想,但工作的时刻!见<一href=\"https://github.com/jvc26/dotfiles/blob/master/.vimrc\">https://github.com/jvc26/dotfiles/blob/master/.vimrc了解详情。

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.

谢谢!

推荐答案

以上映射解决方案不会影响到命令模式或视觉模式。以下是一个比较理想的解决方案,直到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):

""""""""""""""
" tmux fixes "
""""""""""""""
" Handle tmux $TERM quirks in vim
if $TERM =~ '^screen-256color'
    map <Esc>OH <Home>
    map! <Esc>OH <Home>
    map <Esc>OF <End>
    map! <Esc>OF <End>
endif

这篇关于随着$ TERM =下TMUX'屏幕256color',Home和End键不起作用。为什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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