Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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
share|improve this question

3 Answers 3

up vote 2 down vote accepted

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.

share|improve this answer

I almost always run emacs with -nw. In order to scroll to the end of the file, I use M-S-, and M-S-. to get back to the start (maybe easier to remember as Alt-< and Alt->). Not quite as convenient as C-Home and C-End perhaps, but I prefer to work from the terminal (actually from within a tmux session, for what it's worth).

share|improve this answer

Do yourself a favour and do the tutorial :)

emacs by default uses classic line editor bindings.

Ctrl a  << to start of line
Ctrl e  >> to end of line
Ctrl k  cut to end of line
Ctrl y  yank that back
alt y   roll back one more yank (repeat) try it out to get it.

They are the ones I use the most and these also work with readline (most shells)

Google or dig around on your system for cheat sheets.

e.g.

 /usr/share/emacs/23.4/etc/refcards/refcard.pdf
share|improve this answer
    
Good for you @petergozz, I wanted to use Ctrl-HOME and Ctrl-END as the original question asked. Thanks for trying to help, but I have been using Emacs 20 yrs and didn't need a refresher course on line editor bindings per se. My enquiry was specifically about running Emacs in my terminal environment and the idiosyncrasies of that situation. Ctrl a << to start of line? Are you serious? –  codeitagile Apr 19 '12 at 7:14
    
Oops Sorry. Oh there is no << that's just sugar. –  petergozz Jun 25 '12 at 16:35

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.