 |
|
|
Emacs is a very powerful text editor which you can use to create or edit text files on CUNIX. To start Emacs, type emacs at the UNIX $ prompt. Editing commands are issued by first pressing the Escape key (shown below as M) followed by a command character or by holding down the Control key (shown below as C) and typing a command character.
Emacs 20.7, the version available on the CUNIX Cluster, has X-windows (graphics) support: when run in an X environment, such as on a ColumbiaNet Station or an HP workstation (251 Mudd), and the DISPLAY variable is set correctly, Emacs is displayed in a separate window with a pull-down menu on the top and full mouse control.
If you are using Emacs outside an X environment and want to remove the pull-down menu for the current session, type Esc-X menu-bar-mode. To permanently remove this option, include the following line in the .emacs init file found in your home directory:
(menu-bar-mode nil)
See the man page ($ man emacs) for more information on using Emacs.
Glossary
| C- |
A control character. C-f means hold down the key marked Control or CTRL and then type f |
| M- |
A two-character command sequence where the first is the key marked ESC. M-f means press ESC, then f. |
| M-x string |
A command obtained by typing in its name. M-x revert-buffer means type ESC then x then revert-buffer then press the Enter or Return key. |
| point |
Emacs term for cursor position in current buffer |
| mark |
An invisible text marker in the file |
Help and Information Functions
| C-h t |
Display the Emacs tutorial (for novices) |
| C-h i |
Enter Info, the internal documentation browser |
| C-g |
Abort the current command (quit) |
| C-h m |
Describe special Emacs commands that are currently available |
|
| C-h k |
Describe a particular command (for example, C-h k C-a describes the C-a command) |
| C-h l |
Show the last 60 characters and commands typed |
| C-_ |
Undo effect of the last change/command (can be repeated) |
| C-h a string |
Show all commands containing string in their name |
| M-n |
Used before a command, repeats it n times (same as C-u n) |
| C-q |
Insert special characters (for example, typing C-q C-l inserts C-l) |
| C-x d |
Display and edit directory lists (C-h m shows commands) |
Getting out
| C-x C-s |
Write this buffer to disk (overwrites old file contents) |
| C-x C-w string |
Write this buffer to a disk file with specified name |
| C-x C-z |
Exit to the shell (can be continued later) |
| C-x C-c |
Exit and kill this Emacs (cannot be continued later) |
| M-x shell |
Start up a UNIX shell in its own buffer |
Buffer Operations
| C-x C-f file |
Get or create file named file in buffer of same name |
| C-x b file |
Select existing buffer named file for editing |
| C-x k file |
Delete buffer named file |
| C-x C-b |
Display the list of available buffers |
| M-< |
Move to the top of the current buffer/file |
| M-> |
Move to the end of the current buffer/file |
Character Operations
| C-b |
Move point one character to the left (backward) |
| C-f |
Move point one character to the right (forward) |
| C-p |
Move point up one line (previous line) |
| C-n |
Move point down one line (next line) |
| DELETE |
Delete character to the left of point (also marked RUBOUT) |
| C-d |
Delete character to the right of (or under) point |
| C-t |
Transpose two characters around point (for example, ht becomes th) |
Word Operations
| M-b |
Move point one word to the left (backward word) |
| M-f |
Move point one word to the right (forward word) |
| M-DELETE |
Delete one word to the left (C-y yanks it back at point) |
| M-d |
Delete one word to the right (C-y yanks it back at point) |
| M-t |
Reverse words around point (for example, if only becomes only if) |
Line Operations
| C-a |
Move point to the beginning of this line |
| C-e |
Move point to the end of this line |
| C-o |
Open up blank line at point |
| C-x C-o |
Close up all blank lines above and below point |
| C-k |
Delete from point to end of line (C-y yanks it back) |
| M-0 C-k |
Delete from beginning of line to point (C-y yanks it back ) |
Sentence Operations
| M-a |
Move point to the beginning of this sentence |
| M-e |
Move point to the end of this sentence |
| C-x DELETE |
Delete beginning of sentence to point (C-y yanks it back) |
| M-k |
Delete from point to end of sentence (C-y yanks it back) |
Paragraph Operations
| M-{ |
Move point to beginning of this paragraph |
| M-} |
Move point to end of this paragraph |
| M-q |
Fill this paragraph |
| M-1 M-q |
Justify this paragraph |
| M-n C-x f |
Set fill column to n (for example, M-60 C-x f sets it to 60) |
Screen Operations
| C-v |
Move to next screen of text (screens overlap by one line) |
| M-v |
Move to previous screen (overlaps by one line) |
| C-l |
Redisplay current screen and center point |
Page Operations
| C-x [ |
Move to beginning of this page (previous C-lcharacter) |
| C-x ] |
Move to end of current page (next C-lcharacter) |
Search and Replace
| C-s string |
Search forward for string, one character at a time |
| C-r string |
Search backward for string, one character at a time |
| M-x replace-string string1 string2 |
Replace string1 with string2 (prompts for strings) |
| M-x query-replace string1 string2 |
Optionally replace string1 with string2, but confirms each |
Region Operations
A region is the area of buffer between the point and mark.
Some commands set the mark, so check them before using.
| C-@ |
Set the mark |
| C-x C-x |
Exchange point and mark (move to other end of region) |
| C-w |
Delete region (C-y yanks it back) |
| C-y |
Yank back the last deleted text at point |
Window Operations
| C-x 2 |
Split screen into two windows (same buffer in each) |
| C-x 1 |
Make this window the only one (delete all others) |
| C-x o |
Move to other window on screen |
| ESC C-v |
Display the next screen in the other window |
|
 |
|
 |