首页/ End键不TMUX工作 [英] Home/End keys do not work in tmux

查看:266
本文介绍了首页/ End键不TMUX工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前使用TMUX用的xterm-256color $ TERM变量。当在TMUX bash中,pressing Home / End键将插入字符波浪号(〜)。 TMUX以外的家庭/结束键做工精细。

I'm currently using tmux with xterm-256color $TERM variable. When in bash under tmux, pressing home/end would insert tilde characters (~). Outside of tmux the home/end keys work fine.

使用猫tput的,我可以看到,有产生和预期序列之间的不匹配:

Using cat and tput, I could see that there was a mismatch between the generated and expected sequences:

$ cat -v # pressing home, then end
^[[1~^[[4~
$ tput khome | cat -v; echo
^[OH
$ tput kend | cat -v; echo
^[OF

要解决这个问题,我决定把以下内容添加到我的.bashrc:

To fix this, I decided to add the following to my .bashrc:

if [[ -n "$TMUX" ]]; then
    bind '"\e[1~":"\eOH"'
    bind '"\e[4~":"\eOF"'
fi

这是固定的bash的问题,但是在其他readline的程序,如REPL内,如IPython中,它仍然插入家用/结束波浪号。

That fixed the problem for bash, however in other readline programs, such as within a REPL such as ipython, it still inserts a tilde for home/end.

到底为什么这是摆在首位的问题吗?为什么生成的序列不同的,当我在里面TMUX VS外面呢?如何解决这一问题,以便它不是在任何程序的问题?

Why exactly is this a problem in the first place? Why is the generated sequence different when I'm inside tmux vs outside it? How can fix this so that it's not an issue in any programs?

推荐答案

它出现的主要问题是使用的xterm-256color为$ TERM。我切换$ TERM到屏幕256color和问题走了。

It appears the main problem is with using xterm-256color for $TERM. I switched $TERM to screen-256color and the problem went away.

这篇关于首页/ End键不TMUX工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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