-->
Previous Table of Contents Next


Basic Command Summary

Table 28.4 gives a brief listing of the major commands provided by emacs. <Esc><c> means to press and release the meta key—usually the <Esc> key on a PC keyboard, although on some keyboards you can use the <Alt> key and then press the following <c> key. <Ctrl-c> means to press the <Ctrl> key and the <c> key at the same time. Remember, pressing <Ctrl-g> at any time stops the currently executing command.

Table 28.4 Basic emacs Commands

Key Sequence Description

Saving to Disk

<Ctrl-x><Ctrl-s> Saves current buffer to disk
<Ctrl-x><Ctrl-w> Writes current buffer to disk, asking for a new filename
<Ctrl-x><n> Changes filename of current buffer
<Esc><z> Writes all changed buffers to disk and exits emacs
 
Reading from Disk

<Ctrl-x><Ctrl-f> Finds file, reads into a new buffer created from filename
<Ctrl-x><Ctrl-r> Reads file into current buffer, erasing previous contents
<Ctrl-x><Ctrl-i> Inserts file into the current buffer at the cursor’s location
 
Moving the Cursor

<Ctrl-f> Moves forward one character
<Ctrl-b> Moves backward one character
<Ctrl-a> Moves to front of current line
<Ctrl-e> Moves to end of current line
<Ctrl-n> Moves to next line
<Ctrl-p> Moves to previous line
<Esc><f> Moves forward a word
<Esc><b> Moves backward a word
<Esc><a> Goes to a line
<Esc><Shift-.> Moves to beginning of buffer
<Esc><Shift-,> Moves to end of buffer
 
Deleting and Inserting

<Ctrl-d> Deletes next character
<Ctrl-c> Inserts a space
<Esc><d> Deletes next word
<Ctrl-k> Deletes to end of current line
<Return> Inserts a new line
<Ctrl-j> Inserts a new line and indent
<Ctrl-o> Opens a new line
<Ctrl-w> Deletes region between mark and cursor
<Esc><w> Copies region to kill buffer
<Ctrl-x><Ctrl-o> Deletes lines around cursor
 
Searching and Replacing

<Ctrl-s> Searches forward from current position
<Ctrl-r> Reverses search from current position
<Ctrl-x><s> Repeats search forward
<Ctrl-x><r> Repeats search in reverse
<Esc><r> Replaces all instances of first typed string in mini-buffer with second typed string, ending each string with <Esc>
<Esc><Ctrl-r> Queries before performing the replacement.
Answer in the mini-buffer with one of the following:
<Ctrl-g>: Cancels operation
<!>: Replaces the rest
<?>: Gets a list of options
<.>: Exits to where command was initiated
<y> or Spacebar: Replaces and continues with replace operation
<n>: Doesn’t replace but continues with replace operation
 
Marked Text

<Ctrl><Spacebar> Sets mark at current cursor position
<Ctrl-x><Ctrl-x> Exchanges mark and cursor
<Ctrl-w> Deletes the marked region
<Esc-w> Copies marked region to kill buffer
<Ctrl-y> Inserts the kill buffer at the current cursor position
 
Buffers

<Ctrl-x><b> Switches to another buffer
<Ctrl-x><x> Switches to next buffer in buffer list
<Esc><Ctrl-n> Changes name of current buffer
<Ctrl-x><k> Deletes a non-displayed buffer


Previous Table of Contents Next