shift向上箭头不会突出显示文本emacs iterm2

我最近帮助修复M-left等等: emacs in terminal meta arrow keybindings,但我无法使用类似的解决方案修复Shift-up.当我尝试升档时,我收到错误< select>未定义.我尝试使用以下方法重新映射它:

(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.

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

基于这个2008 bug report discussion,我通过在〜/ .bashrc的顶部添加以下内容来解决我的问题:

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

N.B.,无论是xterm-vt220还是默认的xterm,emacs -Q -nw都是ESC [4~当我按下END,ESC O A为Up,而ESC [A为Shift-Up. (要查看Emacs获得的密钥代码,请按一些按钮然后按Ch,l.)对于相同顺序的相同按键,cat说[4~,[A和[OA … so up和Shift-Up是奇怪地逆转了.

如果您不想更改terminfo,请参阅此讨论以获取解决方法
http://lists.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])

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

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

相关文章
相关标签/搜索