Emacs is an editor that is very common on the networks. It is an extremely powerful editor and trying to explain it all would take a book. But entry-level emacs is fairly simple and with only a few basic commands anyone can use it productively.
Characters in strings indicate a command sequence.
'^X^C' means control-x then control-c
'^X-i' means control-x then just plain 'i'.
To enter emacs to edit a file, simply enter 'emacs filename' at your prompt. If you use the name of an existing file you will automatically load the file into emacs to be edited. If you use a new file name you will create a new file with the editor.
You can use emacs as your editor in nearly every application that calls for one. Therefore, emacs can be your editor for direct file editing and netnews. If you would like to use emacs for all of your editing, and have it be the default for programs using an editor, you can modify your '.login' file. The .login is the file where your defaults are stored. Emacs the .login and add these two lines:
setenv EDITOR /usr/local/bin/emacs
setenv VISUAL /usr/local/bin/emacs
These are called environment variables and many programs use these for their default settings. To make these take effect immediately type source .login. This will be done automatically the next time you login.
Before explaining the commands, you need to understand some of the terminology. A letter preceded by a ^ indicates that letter is a control character. For instance, ^X means you hold down the Ctrl key while pressing x. It is convention to use uppercase when writing these characters into a manual; however, you do NOT press shift while typing them.
A letter preceded by M- indicates that the letter is a Meta command. Meta is entered as ^[, or control left bracket. Using control and meta commands, and combinations thereof, allow you to do a wide range of tasks within emacs. The following list is by no means complete, it only covers the basic commands you need to get started.
Note: Most of these commands are standard, but some are particular to WPI. If you use another site, double check these commands before using them.
|^D||Delete character cursor is on.|
|^K||Kill from the cursor to the end of the line, stores deleted text in kill ring. You can store as much text in the kill ring as you'd like with successive kills.|
|^Y||Yanks text back from kill ring. Use with ^K for cut and paste editing.|
|^L||Reset and clear screen.|
|^A||Move to the start of the line.|
|^E||Move to the end of the line.|
|^F||Move forward (right) one character. (right arrow)|
|^B||Move backward (left) one character (left arrow)|
|^P||Move up one line. (up arrow)|
|^N||Move down one line. (down arrow)|
|^G||When all else fails, quit emacs. Use this in case you make a typo with a command, it will abort the command.|
|^T||Transpose char on cursor and before cursor.|
|^Z||Pause the job. fg at your prompt will restart it.|
|^U||Followed by number, ^U will repeat the next argument that number of times. Without a number it is a multiple of 4: ^U is times 4, ^U^U is times 16, etc.|
|^O||Insert blank line after the cursor.|
|^V||Scroll down one page.|
|M-v||Scroll up one page.|
|M-f||Move forward (right) one word.|
|M-b||Move backward (left) one word.|
|M-<||Move to the top of the file.|
|M->||Move to the bottom of the file.|
|^X-u||Undo one batch of changes.|
|^X-s||Save the file.|
|^X-i||Insert another file into the current file.|
|M-s||Center entire line.|
|M-S||Center entire paragraph.|
|^X^C||Exit emacs and save the file.|
Last modified: May 17, 2004, 13:46 EDT