Emacs is a full screen editor available on most all UNIX systems. This editor is extremely broad ranged, and includes its own file management and mail system; however, its commands are so arcane as to be totally obtuse. That notwithstanding, it is pretty much the UNIX standard for editors, so it may pay to become familiar with it; Emacs is also available for Windows.
When a command is given, such as emacs, follow the command with the carriage return, send, enter key, etc. When the command includes the following control keys, it is generally not necessary to press the enter key.
| <CTL>- | press the CONTROL key simultaneously with the second key. |
| <ESC> | press the ESCAPE key, then press the second key. (on a true UNIX terminal, the META key) |
Terms such as "filename" mean insert the name of the file you wish to edit, etc.; also, |
|
| <CR> | press the "enter" (or analogous) key at this point |
| <backspace> | press the "backspace" key at this point |
| <spacebar> | press the "spacebar" key at this point |
| <text> | enter text as appropriate (generally specified) |
|
[ TOP ]
GETTING STARTED, GETTING OUT, RECOVERING FROM DISASTERS |
||||
| Your goal | What you type | |||
|---|---|---|---|---|
| start the Emacs editor | emacs | |||
| start Emacs and edit a named file | emacs "filename" | |||
| quit Emacs permanently | <CTL>-x <CTL>-c | |||
| suspend Emacs and keep all editing | <CTL>-z | |||
| return to Emacs if suspended | fg (or %) | [if emacs is the only suspended process] OR | ||
| fg %1 (or %1) | [if emacs is the 1st suspended process] OR | |||
| fg %n (or %n) | [if emacs is the nth suspended process] OR | |||
| %emacs | ||||
| abort a partially typed or executing command | <CTL>-a | |||
| undo an unwanted change | <CTL>-x u | |||
| undo the last command | <CTL>-x 4 | |||
| recover file lost by system crash | <ESC> x | |||
| exit recursive editing | <ESC> x top-level | |||
| redraw a garbled screen | <CTL>-l | [that's the letter l, not the number 1] | ||
[ TOP ]
HELP |
||||
| Your goal | What you type | |||
| getting help | <CTL> h | |||
| getting help on a specific command | <CTL> h c <command> | |||
| getting help appropo some task | <CTL> h a <task> | |||
| getting help on a specific command | <CTL> h f <function> | |||
| kill help | <CTL> h k <command> | |||
| start the Emacs tutorial | <CTL>-h <CTL>-h | |||
[ TOP ]
CURSOR CONTROL |
||||
| Your goal | What you type | |||
| character forward | <CTL>-f | |||
| character backward | <CTL>-b | |||
| word forward | <ESC> f | |||
| word backward | <ESC> b | |||
| next line | <CTL>-n | |||
| previous line | <CTL>-p | |||
| beginning of line | <CTL>-a | |||
| end of line | <CTL>-e | |||
| beginning of sentence | <ESC> a | |||
| end of sentence | <ESC> e | |||
| forward one screen | <CTL>-v | |||
| backward one screen | <ESC> v | |||
| beginning of file | <ESC> < | |||
| end of file | <ESC> > | |||
| beginning of paragraph | <ESC> ] | |||
| end of paragraph | <ESC> [ | |||
| go to a specific line (number) | <ESC> x goto-line <CR> <line> <CR> | |||
[ TOP ]
DELETING [KILLING] WORDS, CHARACTERS, ETC., & YANKING THEM BACK |
||||
| Your goal | What you type | |||
| delete character before cursor | <backspace> | |||
| delete character over cursor | <CTL>-d | |||
| delete word before cursor | <ESC> <backspace> | |||
| delete word after cursor | <ESC> d | [ddelete] | ||
| delete from cursor to end of line | <CTL>-k | [kill] | ||
| delete from cursor to end of line (plus EOL) | <CTL-k><CTL-k> | |||
| delete from cursor to start of line | <CTL-x><CTL-k> | |||
| delete from cursor to end of sentence | <ESC> k | |||
| undelete last deletion | <CTL>-y | [yank] | ||
| toggle back through previous deletions | <ESC> y | |||
[ TOP ]
GETTING FILES, WRITING FILES, USING THE EMACS DIRECTORY MANAGEMENT SYSTEM |
||||
| Your goal | What you type | |||
| Read a file into Emacs | <CTL>-x <CTL>-f | |||
| Read a different file | <CTL>-x <CTL>-v | |||
| Save the file on the screen | <CTL>-x <CTL>-s | |||
| Write the file on the screen to a new name | <CTL>-x <CTL>-w | |||
| Insert an existing file at the cursor | <CTL>-x i | |||
| -- Emacs Directory Functions: | ||||
| List what's in the working directory | <CTL>-x d | |||
| Once this listing is on the screen, place the cursor on a file name to... | ||||
edit the file: |
f | |||
view the file: |
v | |||
copy the file: |
c | |||
rename the file: |
r | |||
delete the file: |
d | |||
unmark the file for deletion: |
u | |||
use a prompt screen for deletions: |
x | |||
to execute the deletions: |
yes | |||
[ TOP ]
BUFFERS & REGISTERS -- Temporary storage areas for marking & copying text |
||||
| Your goal | What you type | |||
| set mark at cursor | <CTL>-@ | |||
| exchange the mark with the cursor | <CTL>-x <CTL>-x | |||
| mark paragraph | <ESC> h | |||
| mark page | <CTL>-c <CTL>-p | |||
| mark entire buffer | <CTL>-x h | |||
| kill region | <CTL>-w | |||
| kill entire buffer | <CTL>-x k | |||
| -- there may be more than one buffer that may be selected: | ||||
| select another buffer | <CTL>-x b | |||
| list all buffers | <CTL>-x <CTL>-b | |||
| -- to move or copy within a single buffer or between two buffers by using a register (what word processors call cut-and-paste): |
||||
|
(1) mark beginning of area to cut/copy (2) move cursor to end of area to copy (up or down) (3) then . . . |
||||
| copy the region to register | <CTL>-x x | [give it a name] | ||
| If cutting (not copying) | <CTL>-w | [deletes the region] | ||
| insert register contents at cursor | <CTL>-x g | [name the register to get] | ||
[ TOP ]
WINDOWS |
||||
| Your goal | What you type | |||
| split the screen into windows, vertically | <CTL>-x 2 | |||
| split the screen into windows, horizontally | <CTL>-x 5 | |||
| delete all windows, leaving single screen | <CTL>-x 1 | |||
| delete current window | <CTL>-x 0 | |||
| switch cursor to another window | <CTL>-x o | |||
| scroll the other window | <CTL>-<ESC> | |||
| -- commands for other windows; | ||||
| select named buffer in other window: | ||||
| create the other window | <CTL>-x 4 "filename" | |||
| find named file in other window | <CTL>-x 4 f "filename" | |||
| run directory in other window | <CTL>-x 4 d | |||
[ TOP ]
SEARCH AND REPLACE |
||||
| -- Search | ||||
| Your goal | What you type | |||
| search forward | <CTL>-s | |||
| search backward | <CTL>-r | |||
| repeat forward search | <CTL>-s | |||
| repeat backward search | <CTL>-r | |||
| exit search | <ESC> | |||
| undo last character typed | <backspace> | |||
| abort search | <CTL>-g | |||
-- Replace |
||||
| To replace a string (and be prompted prior to the replacement) | ||||
(1) type <ESC> % |
[you will be prompted for the string to be replaced] | |||
(2) enter the string and press enter |
[you will then be prompted for the replacement string] | |||
(3) each time the string to be replace is found you will be asked to confirm you wish to replace it: respond with one of the following . . . |
||||
Your goal |
What you type | |||
– replace and go to next occurrence |
<spacebar> | |||
– replace and do not go to next occurrence |
<,> | |||
– don't replace and go to next occurrence |
<backspace> | |||
– replace all remaining matches |
<!> | |||
– exit search and replace |
<ESC> | |||
| - - OR - - | ||||
| To replace from the cursor on: <ESC> x repl s <CR> <find_string> <CR> <replace_string> <CR> |
||||
[ TOP ]
EDITING THE EMACS COMMAND LINE (The "Minibuffer") |
||||
| Your goal | What you type | |||
| complete as much as possible | <TAB> | |||
| complete up to one word | <spacebar> | |||
| complete and execute | <CR> | |||
| show possible commands to complete | <?> | |||
| abort the command | <CTL>-g | |||
| repeat and edit the last command | <CTL>-x <ESC> | |||
| get help | <CTL>-h | |||
[ TOP ]
CHANGING EMACS EDITING MODES |
||||
| Emacs may edit in various programming languages, for plain text, or other purposes. The default mode is FUNDAMENTAL (as noted on the bottom of the screen). | ||||
| Your goal | What you type | |||
| change mode to text mode | <ESC> x text-mode | |||
| change mode to fundamental mode | <ESC> x fundamental-mode | |||
| change mode to auto-fill (aka word-wrap) | <ESC> x auto-fill-mode | |||
| realign a paragraph after insertions | <ESC> q | |||
| set margins | <CTL>-x f <n> | [<n> is the width of the page] | ||
| help on mode | <CTL>-h m | |||
[ TOP ]
OBTAINING EMACS |
||||
| Emacs (for UNIX and Windows) is available from the GNU Project. General information is under Emacs. Downloads generally are at http://ftp.gnu.org/pub/gnu/emacs/; for windows users the executable may be downloaded from http://ftp.gnu.org/gnu/windows/emacs/ or from http://ftp.gnu.org/pub/gnu/emacs/windows/. Additional Emacs-related links on are on the Links page. | ||||
|
Document: http://
Revised: |
Copyright © 2004
Steve Sconfienza, Ph.D.
All Rights Reserved