Shift arrow selection in emacs

假如想象 提交于 2019-12-04 02:31:09

问题


I'm using GNU Emacs 23.2.1
my init.el

(cua-mode 1)               
(transient-mark-mode 1)    
(setq shift-select-mode t) 
(global-linum-mode 1)      
(show-paren-mode 1)        
(desktop-save-mode 1)      

So, instead of selection I get 2C on Shift =>, 2D on Shift <=, etc. How to solve this?

P.S.
cat -v for Shift <=
^[[1;2D
cat -v for Shift =>
^[[1;2C

How I can map properly those keys to shift-left, shift-right corresponding?

P.P.S.
Sorry. I've forgot. I'm also using screen.

den@playground:~/.emacs.den$ echo $TERM  
screen  

Solution:

(define-key input-decode-map "\e[1;2D" [S-left])  
(define-key input-decode-map "\e[1;2C" [S-right])  
(define-key input-decode-map "\e[1;2B" [S-down])  
(define-key input-decode-map "\e[1;2A" [S-up])  
(define-key input-decode-map "\e[1;2F" [S-end])  
(define-key input-decode-map "\e[1;2H" [S-home])

回答1:


This means emacs and your terminal do not agree on what the various key codes mean. there are more advanced ways to configure terminals (terminal specific files), but to get you started, try adding something like this to your emacs init file:

(define-key input-decode-map "\e[1;2D" [S-left])
(define-key input-decode-map "\e[1;2C" [S-right])



回答2:


This usually happens when you run emacs in a console. Try running emacs as a graphical program and this should not be an issue.



来源:https://stackoverflow.com/questions/11721224/shift-arrow-selection-in-emacs

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!