向上箭头不突出显示文本emacs iterm2 [英] shift up-arrow doesn't highlight text emacs iterm2

查看:144
本文介绍了向上箭头不突出显示文本emacs iterm2的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我最近有帮助修复 M-left 等等: emacs在终端元素箭头键绑定,但是无法使用类似的解决方案修复 Shift-up 。当我尝试 shift-up 我收到错误< select>未定义。我试过重新映射它:

I recently had help fixing M-left and so forth here: emacs in terminal meta arrow keybindings, but am unable to fix Shift-up using a similar solution. When I try shift-up I get an error <select> is undefined. I've tried re-mapping it using:

(add-hook 'term-setup-hook                                                                                                                                                                         
'(lambda ()                                                                                                                                                                                      
 (define-key function-key-map "\e[1;9A" [M-up])                                                                                                                                                
 (define-key function-key-map "\e[1;9B" [M-down])                                                                                                                                              
 (define-key function-key-map "\e[1;9C" [M-right])                                                                                                                                             
 (define-key function-key-map "\e[1;2A" [S-up])                                                                                                                                                
 (define-key function-key-map "\e[1;9D" [M-left])))  

但是移位仍然未定义。我还尝试重新键入密钥,使用从 cat 返回的转义序列设置它,这是 ^ [[1; 2A 。奇怪的是,下坡就行了。 shift-select-mode 也被标记为 t

But shift remains undefined. I also tried rebinding the key by setting it using the escape sequence returned from cat which is ^[[1;2A. Oddly enough shift down does work. shift-select-mode is marked at t as well.

推荐答案

这听起来像是通过Putty访问Ubuntu 12.04机器的一个麻烦,当END导致Emacs 23.3.1说< select>未定义。原来是 terminfo 的问题,让程序以独立于设备的方式使用终端。

This sounds like a trouble I had accessing a Ubuntu 12.04 machine via Putty, when END caused Emacs 23.3.1 to say <select> is undefined. That turned out to be an issue with the terminfo that lets programs use terminals in a device independent way.

根据这个 2008 bug报告讨论,我通过将以下内容添加到我的〜/ .bashrc:

Based on this 2008 bug report discussion, I solved my problem by adding the following to the top of my ~/.bashrc:

#so the END key will work correctly in Emacs over PuTTY
TERM=xterm-vt220

注意,使用xterm-vt220或默认xterm, emacs -Q -nw当我按END, ESC OA 为Up时,正在获得 ESC [4〜 ESC [A Ch,l 。)对于相同顺序的相同键, cat [4〜 [A [OA ...所以向上和Shift-Up是奇怪的逆转。

N.B., with either xterm-vt220 or the default xterm, emacs -Q -nw is getting ESC [ 4 ~ when I press END, ESC O A for Up, and ESC [ A for Shift-Up. (To see what keycodes Emacs is getting, press some buttons and then C-h,l.) For the same keys in the same order, cat says [4~, [A, and [OA...so Up and Shift-Up are oddly reversed.



如果你不想改变你的terminfo ,请参阅此讨论解决方案
http://list .gnu.org / archive / html / help-gnu-emacs / 2011-05 / msg00211.html


你应该可以通过以下方式解决问题:

You should be able to work around the issue with something like:

(define-key input-decode-map\e [1; 2A [S-up])

为了在正确的时间生效,你必须在你的.emacs中使用:

And for this to take effect at the right time, you will have to use in your .emacs something like:

(if(equalxterm(tty-type))
(define-key input-decode-map\e [1; 2A[S-up]))

这篇关于向上箭头不突出显示文本emacs iterm2的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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