next up previous
Next: Tab completion of file Up: emacs Previous: Anatomy of the standard

Standard editing hot keys.

It is said that emacs uses hot keys (key bindings) so extensively, if you hold down the Control key and type your name, each keystroke will do something - whether you like it or not.

It is useful to learn some standard emacs editing ``hot keys'', since they save wrist motion, are used elsewhere in Unix, and are necessary if you find yourself running emacs without the mouse. For example, within the tcsh command interpretor, you can use them to edit a command you are typing.

Some of the menu selections tell you the corresponding hot keys, so you can learn them as you go. But there are lots of useful commands that do not appear in the menu selections.

Here is a list of some common hot keys, all of them invoked by holding down the Control key and typing the letter:

C-d Delete under the cursor
C-k Kill the rest of the line (save in kill ring)
C-y Restore (``yank'') from the kill ring
C-a Beginning of the line
C-e End of the line
C-f Forward one character
C-b Back one character
C-p Previous line
C-n Next line

With the tcsh and bash shells, these emacs commands also happen to work in a terminal window! The first ones move the cursor around in a single command line. The last two move backward or forward in the command history. That gives you an easy way to recall a previous command and rerun it.

Here are some others that don't apply to tcsh or bash:

C-x u Undo the last edit
C-g Cancel the current command
C-v Down one page
M-v Up one page
M-< Go to the top of the buffer
M-> Go to the end of the buffer
M-d Delete the next ``word''.
C-x-C-f Edit a file in a new buffer (type its name)
C-x-C-s Save the current buffer
C-x-C-c Exit emacs
The M- stands for the ``meta'' key. On our keyboards it is the ``Alt'' key just next to the spacebar on either side. That key works like the Control key or Shift key in that you type the letter while holding it down. If that fails, you can use the Esc key, but in that case you don't hold it down. Just hit Esc and then the letter.

The C-x u undo command can be repeated to move backwards in the editing history. The undo operations themselves also become part of the editing history, so if after a string of undos and some typing you changed your mind, you can use undo to undo your typing and then reverse the undo's!


next up previous
Next: Tab completion of file Up: emacs Previous: Anatomy of the standard
Carleton DeTar 2016-12-29