| CIRCA Unix
Services
This handout can be found online at: | Using emacs on the CIRCA Unix
system August 23, 2005 |
The emacs editor is a powerful editor found on some Unix systems. This handout is only a brief guide to using the emacs editor.
Use the control key (Ctrl) in combination with another key to send a special control character to the computer. The control key is like a shift key that is held down while another key is pressed. For example, to type Ctrl-U, press and hold the Ctrl key and press the U key. In the emacs manual and emacs online information, C-x is used to mean Ctrl-x.The Esc key sends a special character, called the escape character to the computer. If your terminal or workstation does not have an Esc key, or if the Esc key doesn't seem to work correctly, you can type Ctrl-[ to send the escape character.
Meta characters are unique to emacs. In this handout and in most Unix documentation, the use of a meta character is shown as M-x. This means that you must first type the meta key and then the x key. In most versions of emacs, the Esc key is used as the meta key. If you're using the CIRCA Unix system from a VT220 in E211 CSE, you can also use the F11 key as the meta key.
To start the emacs editor, type the emacs command with the name of the file to be edited. For example, to edit the file test.f, type this command:emacs test.f
To exit the editor and save the file you're working on, follow these steps:
- Type Ctrl-x, Ctrl-c.
- If you've made changes to the file, emacs will ask you whether you want to save the changes. Press the "y" or "n" key for either yes or no.
- If you type "n", emacs will ask you if you are sure you want to quit without saving the file. If you are sure, type "yes" and press Return.
Emacs has features and modes that you might accidentally activate by pressing the wrong key. If you find yourself stuck, try typing Ctrl-g.
If you are a new emacs user, you may want to look at the online tutorial. Follow these steps:
- Enter the emacs command without a file name to start emacs.
- Type Ctrl-h and then press the "t" key.
- Follow the tutorial directions on the screen. To leave the tutorial, type Ctrl-g.
Depending on your environment, some emacs functions will not work correctly. In emacs, Ctrl-s is used to begin an incremental search for text, but on many terminals, this will freeze the computer display. To unfreeze the display, type Ctrl-q.Commands to move the cursor
Key How cursor moves ------ ---------------------------- Ctrl-b left one character Ctrl-f right one character Ctrl-n down one line Ctrl-u up one line M-b back a word M-f forward a word Ctrl-a to the beginning of line Ctrl-e to the end of line Ctrl-v forward one screen M-v backward one screen M-< to the top of the buffer M-> to the bottom of the bufferIf your terminal or workstation has arrow keys and emacs has been properly configured, you may be able to use these keys to move the cursor left, right, up, and down.