Unix Emacs Text Editor: Part Two

Removing Text

{DELETE} Delete character left of cursor.
CTRL-d Delete character following cursor.
ESC-DELETE Kill word immediately before cursor.
ESC-d Kill word following cursor.
CTRL-k Kill from cursor to end of line.
ESC-k Kill from cursor to end of sentence.
CTRL-u 15 CTRL-k Kill a block of 15 lines from the current position.
CTRL-@ Start a block.
CTRL-w Kill the block.

Restoring Killed Text

Deletions canot be restored; killed (cut) items can be. Unlike EDT, a kill does not replace previously killed text in the paste buffer. Kills are stacked and accessible. Note that yanking (pasting) an item does not remove it from the stack; a copy is made.

CTRL-y Yank the most recent kill file (paste the last cut).
ESC-y Yank the previous kill. If you exhaust the stack, it starts over with the most recent kill.

Replacing Text

ESC-x repl s{TAB} Emacs will complete the name of the command for you;
{RETURN} After pressing return following the completed command, enter the string to be replaced, and the string to replace it with on seperate lines, followed by {RETURN}s. All instances of the target string occurring after the cursor in the file will be changed.

Searching

This searching is unusual; you will want to read the tutorial on exactly what is going on.

CTRL-s Start the search procedure; type the string to be found. CTRL-s searches forward from the cursor.
CTRL-r Search backwards from the cursor.
ESC-% Run the query-replace command. You will be prompted for the string to replace, and the new string to insert. When the cursor stops at the first instance of the string to replace, enter CTRL-h to see what your options are. Typing a blank will cause it to do the replace on this instance of the string, but there are several other choices.

Changing Modes

ESC-x text-mode Valid modes include fundamental-mode, text-mode, Lisp-mode, etc. Use CTRL-h m to see how modes differ.

Setting the Right Margin and Filling Lines

CTRL-u 20 CTRL-x f Set right margin at column 20.
Esc-x auto-fill-mode Cause lines to fill to specified column and auto-wrap.
ESC-q Cause lines to readjust in the paragraph containing the cursor.

Inserting Test from Elsewhere

ESC-x insert-buffer Insert contents of buffer after current point.
CTRL-x i Insert contents of a file after current point.

Getting on-line Help

CTRL-h ? give listing of available help.
CTRL-h c command-char give the name of the command function.
CTRL-h c command-sequence sequence and char work with both c and k.
CTRL-h k command-char explain the command.
CTRL-h f function-name explain the function.
CTRL-h a word list all commands containing this word.


Previous Page
Index
Next Page