In order to speed up my emacs work flow, I am trying out emacs -nw versus running in X-Windows mode.
Ctrl-HOME and Ctrl-END are not working at all, and have tried editing .keymap files and following online advice has led to no joy unfortunately. E.g.
http://www.emacswiki.org/emacs/CuaMode
I usually enable cua-mode for shift-selection and this also fails when shift-paging up/down e.g.
It would be great to get all this working in -nw mode and I would welcome advice from fellow emacs users.
- Install = Linux Mint 9
- Shell = zsh
Answer
Unfortunately different terminals send different escape sequences for keys like Ctrl+Home, and Emacs doesn't know about all of them. You can declare additional escape sequences through function-key-map
(or local-function-key-map
under Emacs 23). This tells Emacs that these escape sequences are really an encoding for a single function key.
To find out what escape sequence a key sends, press C-q
followed by the key: this will insert the escape character that begins the key sequence literally, followed by the other characters that make up the key sequence. For example, one terminal that I use sends the four characters ^[
, O
, 5
, H
when I press Ctrl+Home, so I would include the following line in my .emacs
:
(define-key function-key-map "\e05H" [C-home])
\e
is the most readable way of writing the escape character. Do the same for other keys you want to support.
If the keys aren't supported out of the box by the latest version of Emacs, it would be nice to tell the developers about the key sequences that your terminal sends.
No comments:
Post a Comment