Editors.
Version 0.17.2


Navindra Umanee
Computer Science
McGill University
<navindra@cs.mcgill.ca>

Abstract

``Why are we hiding from the police, daddy?''
``They use Emacs, son, and we use vi.''

In this chapter I attempt to give you a guide to the various editors available on the SOCS system.

Contents

1  About This Chapter.

1.1  Copyright.

Copyright © 1998 Navindra Umanee <navindra@cs.mcgill.ca>.

Permission is hereby granted to redistribute this work unmodified in content in either source or formatted form, so long as this copyright and the author's names are preserved.

You may also modify this work and distribute the modified work provided that:

  1. This copyright and the author's names are preserved.

  2. You indicate clearly that original work has been modified.

  3. You provide a copy of, or, link to the original work that you modified.

1.2  Availability.

This work is a part of SOCS Inside-Out: The Definitive Survival Guide. You may, however, also obtain it separately in different standalone formats.

1.3  Introduction.

During the course of your program here at SOCS, you will often find that you will need to create and edit text files1, whether to compose an email, write a program, configure an application or for any of a myriad of reasons.

Unix2 has a rich variety of editors available ranging from the minimal to the truly exotic. Here I will cover the editors pico, xedit, asWedit, JOVE, Emacs and vi.

1.4  Organization.

Each editor has its own section, organized in three subsections (and possibly subsubsections):

  1. Editor Basics gives the more rudimentary information needed to get you going.

  2. Advanced tries to be a little more ambitious by giving you hints and tips as well as introducing you to the kinds of things possible with that particular editor.

  3. Summary gives you the bottom line on the suitability of the editor.

1.5  Conventions.

Editor commands sometimes involve the Control key (usually labelled Ctrl or Ctl) or the Meta key. On most contemporary keyboards, the Meta key is labelled Alt.3 If you have no Meta key, you can use Esc instead.

I will use the following convenient abbreviations:

2  The pico Editor.

If you are panicking about which editor to choose, use this one.

Pico is an extremely simple and easy to use editor. It was written in 1989 for the email client Pine by the administrative staff of the University of Washington. Details can be obtained at the Pine Project History webpage.

2.1  Editor Basics.

2.1.1  Getting Your Bearings.

At the shell prompt, type pico. Your screen should show something similar to this.

The first line on the screen is a status bar which gives you information about the pico version you are using, the file you are currently editing and whether or not there are any outstanding modifications that have yet to have been saved. The blank region following the first line is the buffer4, where you type and edit text. More importantly, take a look at the bottom 2 lines of your screen. This is a summary of the more useful keybindings. For example, note ^X Exit at the bottom-left at the screen - this means: press C-x to exit. Above ^X Exit you should also see ^G Getting Help - this means: press C-g to get help. Pico uses ^ as an abbreviation for the Control key.

Now press C-x to get back to the shell prompt. If you typed anything in the buffer, pico will prompt you to save it - simply say `no' by pressing N (again, notice the helpful menu at the bottom).

From now on I will assume that you are smart enough to understand the menu at the bottom as well as pico's prompts to you.

2.1.2  How to Open a New or Existing File.

Type pico <filename> at the shell prompt. <filename> can be a new file or an existing file. If it is a new file, it will be created when you save it in pico. If it is an existing file, you will see the contents of the file in pico and you will be able to change and, if you wish, save them.

Example:

[lisa] [/u2/ugrad/navindra] pico letter-to-mom

An alternate method is to open or create the file from inside of pico.

To create a file simply type out the contents in the buffer, then press C-o and follow the prompts. To open an existing file press C-r followed by C-t and now use the arrow keys to select the file you wish to open. Press Enter and pico will include the contents of the file. Note that in this case, pico is really only inserting the file's contents in the current buffer so when you save the file, you will have to specify or change the filename.

2.1.3  How to Edit a File.

Assuming you have already opened a file, simply use the arrow keys to move the cursor around in the buffer, Backspace to delete unwanted text before your cursor, C-d to delete text at your cursor and the alpha-numeric keys to insert the text you want.

For more information on what you can do, look to the bottom menu. Just about everything you can currently do in pico is listed there. When in doubt, press C-g for help or type man pico at the shell prompt.

2.1.4  How to Save a File.

From within pico, press C-o to save or WriteOut your changes. You will be offered the option of changing the file which is written; if you know what you are doing simply either edit it at the prompt or press C-t to choose the file, else simply press Enter to accept the default.

2.2  Advanced.

There is nothing advanced about this editor. It provides the bare minimum which some find to be sufficient. People have been known to complete their program at SOCS without ever using any editor other than pico - quite obviously those people have lives.

That being said, here are some tips you may find useful.

2.2.1  Tips.

2.3  Summary.

Pico is a simple editor, suitable for a novice or anyone wishing to invest only a minimum amount of time in learning an editor.

3  The xedit Editor.

Xedit a simple text editor for X written by Chris D. Peterson of the (now defunct) MIT X Consortium.

3.1  Editor Basics.

You need to be on a machine running the X Window System (eg, one of the Linux machines) to use this editor. At the machine's shell prompt type: xedit <filename> to open an existing file, or create a new one.

You will be presented with a window such as this.

There are 3 self-explanatory buttons at the top followed by a text-field. You can Quit, Save or Load a file. You can specify the filename in the text-field.

Underneath, you will find a text-field that is 3 lines wide by default. xedit will typically output messages here. You can also use this text-field as a scratch pad.

Finally, below all this is the window where you edit your text.

3.2   Advanced.

xedit actually has some useful Emacs-like keybindings (Emacs is described in section 5). For more information, see the manpage (man xedit). For your convenience, I will list the keybindings here.

KeyFunctionKeyFunction
BindingBinding
C-aBeginning Of Line M-bBackward Word
C-bBackward Character M-fForward Word
C-dDelete Next Character M-iInsert File
C-eEnd Of Line M-kKill To End Of Paragraph
C-fForward Character M-qForm Paragraph
C-gMultiply Reset M-vPrevious Page
C-hDelete Previous Character M-yInsert Current Selection
C-jNewline And Indent M-zScroll One Line Down
C-kKill To End Of Line M-dDelete Next Word
C-lRedraw Display M-DKill Word
C-mNewline M-hDelete Previous Word
C-nNext Line M-HBackward Kill Word
C-oNewline And Backup M-<Beginning Of File
C-pPrevious Line M->End Of File
C-rSearch/Replace Backward M-]Forward Paragraph
C-sSearch/Replace Forward M-[Backward Paragraph
C-tTranspose Characters M-DeleteDelete Previous Word
C-uMultiply by 4 M-ShiftDeleteKill Previous Word
C-vNext Page M-BackspaceDelete Previous Word
C-wKill Selection M-ShiftBackspaceKill Previous Word
C-yUnkill
C-zScroll One Line Up

3.3  Summary.

This editor might look ugly, but it is pretty simple. I have never actually seen anyone seriously using this editor but it may well surpass pico in editing features.

4  The asWedit Editor.

asWedit is a funky GUI editor written by AdvaSoft. See their website at ASWedit and asWedit HTML editors for details.

4.1  Editor Basics.

At any Linux machine, type asWedit (note capitalization) at the machine's shell prompt. This should bring up a nice GUI window with menu and tool bars. You can find out how to create a new file, to open an existing file or to save a file all from the File menu.

For more information on asWedit see the Help menu.

4.2  Advanced.

asWedit is also an HTML editor. For more information, please see the editor's internal documentation.

4.3  Summary.

This editor was mentioned purely for your benefit. Although there was no serious coverage of it, anyone familiar with Windows-type applications is sure to be at home.

5   Emacs.

The first Emacs was born in 1975 at MIT as a set of macros written for the editor TECO5 under ITS6 on a PDP-10 machine. It was written by Richard Matthew Stallman (RMS). RMS went on to write the now widely popular GNU Emacs as part of the GNU project.

There are three levels at which you can use Emacs depending on your level of illumination.

  1. You can use Emacs like you use a regular editor such as pico: Load, Edit, Save and be content.

  2. You can take advantage of Emacs' innumerous specialized modes and functions to ease your editing task or to perform some other function.

  3. You can write your own Emacs functions or modes (or modify existing ones) to do whatever you wish.

I will cover the first item and touch material relevant to the second item in Editor Basics. In the Advanced section I talk more about item 2 and give you pointers on item 3.

5.1   Editor Basics.

5.1.1  Getting Your Bearings.

At the shell prompt, type emacs.78 Your screen should show something similar to this. If you are on a machine running the X Window System, a window will pop up with features similar to those in the previous screenshot.9

The first line on the screen is the menubar (you may not have this if you are using an older version of Emacs or if you are running XEmacs in a terminal window). Novice Emacs users will definitely find it easier to use the menubar at first. Seasoned Emacs users, however, will most likely have no use for this menubar - they will probably turn it off or ignore it and use the keybindings for the relevant functions instead. Anyway, to access this menubar either press the F10 key or M-` or use the mouse if Emacs is running under X. From there, follow the interactive cues and instructions on how to proceed.

From now on, I will assume that you are competent enough to use and understand the menu. Note that although many common functions can be done through the menu, I will not always mention this since you can easily figure it out for yourself.

The region below the menubar displays the contents of the buffer and is where the editing takes place. Emacs can actually have several such regions visible at once but for now you have just one.

The line before the last on the screen is the modeline. This line gives useful information about the status of Emacs and the text you are editing.

The final line is the echo area. Emacs echos your commands here (if you type them too slowly or you pause) and also gives you interactive prompts and information here.

You might have noticed that the buffer is currently advertising the Emacs tutorial. Yes, Emacs is self-documenting so feel free to stop here and go through the tutorial! To find out about other sources of help in Emacs, press F1 ? or C-h ?. In particular, you might also want to refer to the Info documentation for Emacs. You can access this with F1 i or C-h i. A lot of the Info documentation is also available in HTML format, check the Emacs and XEmacs websites.

5.1.2  How to Quit Emacs or Abort a Command.

From the menu, choose Files and then Exit Emacs. Alternately, simply press the C-x C-c key sequence.

If you find yourself in the middle of an Emacs command or key sequence (ie. your cursor is currently in the echo area or the echo area shows that it is waiting for you), you can abort by pressing C-g once or several times. You can also use C-g to stop a command that is taking too long.

5.1.3  How to Open a New or Existing File.

From the shell prompt, type emacs <filename>. <filename> can be a new file or an existing file. If it is a new file, it will be created when you save it. If it is an existing file, you will see the contents of the file in Emacs and you will be able to edit it and, if you wish, save the changes.

Example:

[lisa] [/u2/ugrad/navindra] emacs -q letter-to-mom

From inside Emacs, you must find or visit the file. From the menu choose Files followed by Open File or simply press the C-x C-f key sequence. In both cases you will be presented with a prompt in the echo area. Either type in the filename (or, you may type in . to open up the current directory in dired) if you know it or wish to create a new file, or press Tab one or more times to see a list of completions for the part of the filename you have already typed in (if any). Tab will cause Emacs to complete the filename if only one alternative exists or else it will present you with the alternatives.

There are other ways of opening a file including use of the powerful dired mode. Press C-x d and hit Enter. Emacs will present you with a list of files. Use the arrow keys and Enter to select the desired file.

5.1.4  How to Edit a File.

Assuming you have already opened a file, simply use the arrow keys to move the cursor around in the buffer, Delete to delete unwanted text before your cursor10, C-d to delete text at your cursor and the alpha-numeric keys to insert the text you want.

Here I must mention that seasoned Emacs users generally do not use arrow keys to move around in Emacs. Instead, they use various Emacs key bindings. This is nicer for the touch typist because it means you do not have to move your hands from the home row of the keyboard.

A few relevant navigational key bindings are:

KeyFunctionKeyFunction
BindingBinding
C-bbackward-char (left arrow) M-bbackward-word
C-fforward-char (right arrow) M-fforward-word
C-nnext-line (down arrow) M->end-of-buffer
C-pprevious-line (up arrow) M-<beginning-of-buffer
C-abeginning-of-line M-abackward-sentence
C-eend-of-line M-eforward-sentence
C-vscroll-up M-vscroll-down

There are many more useful functions and features for editing text including the kill/yank functions (similar to cut and paste), unlimited undo and the search/replace functions. I will not cover these because there is really no point when Emacs already has a perfectly good tutorial built into it. I strongly recommend that you take the time to go through this tutorial and familiarize yourself even more with Emacs. It will probably take you 1 or 2 hours but will be worth it in the end. You should learn about buffers and how to manage them amongst other things. To get to the tutorial, press F1 t or C-h t or even M-x help-with-tutorial (see section 5.2.1 for more information on the last form).

5.1.5  How to Save a File.

To save the file you are currently editing, use the menu or press C-x C-s (or C-x s if you wish to be prompted before Emacs does anything). To save the file with a different name, press C-x C-w and enter the new filename (or press Enter to save under the current name).

5.2  Advanced.

Emacs is a real-time display editor that can be extended by the user while it is running. The basic core is a Lisp interpreter implemented in C, with all other functionality implemented in Lisp on top of this interpreter. This has profound consequences: not only does it mean the user can add new editing commands or change old ones by adding or replacing functions, it also implies that Emacs is, by no means, limited to editing. For more information on Emacs' extensibility, I refer you to Richard M. Stallman's old but excellent AI Memo 519a EMACS The Extensible, Customizable Self-Documenting Display Editor.

This extensibility has led to a large number of useful Emacs functions, modes and applications written by free software developers the world over. Emacs is bundled with a large number of these goodies, and XEmacs has even more. Others can be found on the Internet.11

5.2.1   Functions.

Interactive functions (also known as commands) can be invoked by M-x function. Often-used commands are usually bound to key sequences for convenience. Conversely, all bound key sequences in Emacs invoke a command. You can add, modify or remove keybindings at your leisure.

An example command is forward-char. It can be invoked with M-x forward-char12 or any of its default keybindings such as C-f or the arrow key.

You can find out all the keybindings in the current buffer, what command a key sequence will invoke, and more, from within Emacs. See M-x help-for-help or the other Emacs documentation for more information.

There are some functions, such as buffer-name, which you cannot invoke with the M-x syntax and nor can you bind them to a key sequence. You can, however, evaluate these functions in the Lisp interpreter or use them in your own Lisp programs. I will not describe any of this here.

To write your own functions, it helps to be familiar with a Lisp language. The excellent13 308-302 course covers Scheme, a simple Lisp. This course is more than enough to give you a kickstart into Emacs Lisp programming. Other sources of information include the Info documentation, various websites such as Programming in Emacs Lisp or Emacs Lisp Introduction, or even the Emacs source code!

A proper Emacs installation usually includes all the elisp code for the various modes and functions. This is an invaluable resource to the Elisp programmer. The location of the source code is rather system dependent but if you look around long enough you will find it all.14 A handy command included in XEmacs and possibly the latest Emacs, is find-function. This command will find and display the source code for any non-primitive Emacs function.

You can experiment with function-writing in the *scratch* buffer which is in Lisp Interaction mode by default. You may also put permanent functions in your .emacs file (section 5.2.3) or any other file you wish, although, by convention, Emacs Lisp files have .el as the extension. You can load the functions you have saved in a file with the load-file command.

5.2.2  Modes and more.

Emacs has many different major modes, each of which customizes Emacs for editing text of a particular sort. There are major modes for plain text, Lisp, C, C++, Java, Pascal, LATEX, HTML and so on. Major modes are mutually exclusive; at any time, each buffer has one major mode. You can, however, use several minor modes at a time.

One notable mode is the Fundamental mode. This mode has no mode-specific redefinitions or variable settings. Each Emacs command behaves in its most general manner and each option in its default state.

Modes make your life significantly easier. For example, the major mode java-mode along with the minor mode font-lock-mode will display Java code with different colours and fonts for different syntactic elements of the code (see the XEmacs screenshot), auto-indent the code as you write and sometimes give you cues when code is syntactically wrong. Many functions and commands are also provided that allow you to perform powerful operations on your code.

You will find modes for just about anything under the sun. If the mode is not bundled with the current version of Emacs, and the language has been out there for any length of time at all, chances are someone has already written a relevant mode and published it on the Internet.

To learn more about major modes, see the node Major Modes in the Emacs Info documentation.

There are also application-type programs written for Emacs. You can find miscellaneous games (including a graphical tetris), calendars, mail readers, news readers, web browsers and even IRC clients written in elisp.

5.2.3   Customization.

Later versions of Emacs and XEmacs allow you to customize them through a funky point-and-click interface. Type M-x customize to invoke this interface. customize is fine to a point - it is nicely organized, great for such things as visually selecting fonts and colours, changing options from their default values and finding things that can be customized.

Traditionally, Emacs has been customized by editing the .emacs file in the user's home directory. Some people maintain this is still the best way to customize Emacs. However, due to the nice design of customize, nothing is lost with newer versions of Emacs. You can use customize, while retaining the full power of manual .emacs customization.

You would edit .emacs to, amongst other things, set global and local keybindings, change global, mode-local and buffer-local defaults, load extra emacs code, modify functions to change emacs behavior, and write your own handy functions. I should point out that you can very well edit your .emacs without fully understanding elisp, although if things go wrong you might need to seek the help of an Emacs guru.

Useful commands in your .emacs customization quest include describe-mode, apropos, describe-variable, describe-function, find-function. You should read the Emacs documentation or mode specific documentation if you wish to learn more.

Finally, it is very inspiring to look at other people's .emacs files. On the SOCS system, public readable .emacs files include: ~navindra/.emacs, ~jetset/.emacs, ~wheelan/.emacs (Bill Heelan notes that his .emacs on the SOCS system has not necessarily been maintained. However, I believe you can still learn a lot from this file.), ~lucb/.emacs and ~kent/.emacs amongst others. Please note that it is politically correct to properly attribute any significant amount of code you may choose to borrow from these files. Alternately, please obtain the author's permission.

5.2.4   XEmacs.

XEmacs, formerly known as Lucid Emacs, is a direct descendent of an alpha version of Emacs 19. The split occurred because of political differences between free software developers.

XEmacs has some extra features not yet contained in stock Emacs.15 Amongst these are toolbar-support, colour support in terminal mode, inbuffer image support (nice for Gnus, W3, tetris or just for browsing pictures), rather remarkable client/server support and the fact that it is bundled with a larger number of Emacs packages. XEmacs also looks nicer.

Emacs also has a few advantages over XEmacs which include being less bloated and more widely distributed.

To learn more about XEmacs and Emacs, check the XEmacs site.

5.2.5   Tips.

5.2.6  Other Sources of Information.

The Emacs distribution contains a large amount of information. You are encouraged to find and browse the installation tree.

A few of the countless websites that cover Emacs are:

On Usenet, Emacs people hangout on comp.emacs, comp.emacs.xemacs, gnu.emacs.help, gnu.emacs.sources, alt.religion.emacs and the other gnu.emacs.* newsgroups.

5.3  Summary.

This is a remarkable editor and its various characteristics such as extensibility, customizability and innumerous bundled packages are particularly appealing to the programmer.

6  The JOVE Editor.

JOVE stands for Jonathan's Own Version of Emacs and was written by Jonathan Payne. JOVE is very lightweight and starts up faster than Emacs, making it a very popular editor on the SOCS system. JOVE can be customized but does not include an extension language such as Emacs Lisp.

6.1  Editor Basics.

To launch JOVE, simply type jove or jove <filename>.

Most of the Editor Basics described in the Emacs section (section 5.1) as well as the keybindings listed in the xedit advanced section (section 3.2) also apply to JOVE, hence there is no need to redescribe them.

You also want to go through the JOVE tutorial. At the shell prompt, type teachjove.

I must mention that you will probably encounter problems with C-s in JOVE. This is because C-s is bound to STOP-TERMINAL by default on most Unix systems and JOVE does not override this setting. Hence if you press C-s while in JOVE, you screen will seem to freeze. Simple press C-q to unfreeze it. A way around this problem is to type stty stop none from the command prompt17 or to simply avoid C-s in JOVE.

6.2  Advanced.

You should read the JOVE manpage (man jove) to find out about the JOVE initialization file, .joverc, and the commands such as auto-execute-command, set, bind-to-key, etc.

You might also want to take a look at other people's .joverc files. Publically readable .joverc files on the SOCS system include ~wheelan/.joverc (courtesy Bill Heelan) and ~lucb/.joverc (courtesy Luc Boulianne). Again, let me remind you that you should properly attribute any code you may borrow from these files or, obtain the author's blessings.

JOVE can be obtained at the FTP site. All JOVE announcements are posted to the comp.editors newsgroup.

6.3  Summary.

If you like Emacs but are looking for something more lightweight, this is the editor for you.

7   The vi Editor.

In 1976, Bill Joy took the sources of the two line editors ed and ex, and created vi. Vi soon attracted a large following and has since evolved into many different versions for many platforms. The basic concepts of vi have, however, remained unchanged.

Sooner or later you will meet vi simply because it is the editor that is on every Unix system and it is one of the most versatile. Vi also tends to be the default Unix editor.18 With over 200 useful commands, vi may at first sound rather frightening to the beginner but the few introduced here will give you the basics for quick, efficient editing.

7.1  Editor Basics.

7.1.1  Getting Your Bearings.

vi is launched like just about every other editor so far: From the shell prompt type vi or vi <filename>.19 This is where the similarity ends.

I recommend that you now find a dispensable text file and open it up in vi for experimenting.

Before continuing, you must understand that there are two modes in which you use vi:

You can now enter :help to find out what internal documentation your version of vi has to offer. In the case of VIM, this help is pretty extensive, while in the case of `regular' vi, you should at least be offered a summary of all the available vi commands.

I encourage you to play around further with the command and insert modes to ensure you properly understand these concepts. If you are still uncomfortable, then I recommend you read the VI Introductory Guide.

7.1.2  How to Quit vi.

To abort vi without saving any of your changes, switch to command mode and type :quit! or :q!. : tells vi to use the ex interface, and ! specifies that vi should discard any modifications.

7.1.3  How to Open a New or Existing File.

You already know how to open a file from the command line prompt. When in vi, you can type :vi <filename> to do the same. As always, <filename> may refer to a new or existing file. If the current buffer contains unsaved modifications, vi may refuse to open the new file. You must either save (section 7.1.5) the changes or force vi to discard them with :vi! <filename>.

7.1.4  Editing Text.

You already know how to move around in the buffer and how to enter new text. The only major thing left to explain is how to delete text. In command mode, use the following commands.

CommandAction
xDelete character.
dwDelete word.
d$Delete rest of line.
DDelete rest of line.
ddDelete line.

There are of course many other useful editing commands and features in vi. As with the Emacs section, I will not cover these. For more information on (amongst others) numeric arguments, search/replace, undo and copy/paste commands, I recommend the VI Editor Reference Manual.

7.1.5   How to Save a File

Use the the following commands:

CommandAction
:wWrite file.
:w <filename>Write to <filename>.
:w! <filenameOverwrite <filename>.
:wqWrite and quit.
ZZWrite and quit.

7.2  Advanced.

7.2.1  Tips.

A few of the more useful vi commands you should know of are listed below.

CommandAction
JJoin lines.
:sSubstitute on lines matching a regular expression.
This is a very powerful command and I highly
recommend that you read up on it.
!Filter through command(s). You can perform many
powerful operations with this command and the help of
external programs.
:r! <command>Insert the output of a shell command in the buffer.
.Repeat last command.

7.2.2   Customization.

You can customize vi by editing the .exrc file in your home directory. VIM users should put any VIM-specific customizations in .vimrc and source the .exrc if necessary.

As you might have guessed, you can put any ex command in the .exrc. You do not need to specify the :, it is assumed. There are three main kinds of customizations that can be defined in the .exrc:

VIM supports different variations of the above mentioned commands, it is up to you to read up on them. On top of this, VIM also supports several other elaborate commands including if-then control structures.

Here are some illuminating .exrc and .vimrc files. Please note that these files may contain non-text characters so be sure to properly download the file. As always, remember that it is politically correct to properly attribute the author of any code you may choose to borrow.

7.2.3   VIM and more.

VIM is Vi IMproved and has many advantages over standard vi. VIM has been described by some as the Emacs of Vi's. You might want to refer to VIM - Why? for a list of VIM features which include, comprehensive internal documentation, completion, multi-undo, multi-buffer, split-screen and scripting support.

VIM also has a lot of support for programming, such as, macros for compiling and locating compilation errors, auto-indentation features and more.

Also of interest is the fact that VIM supports colours and can optionally provide a Graphical User Interface. See gvim.gif and VIM Pictures for some screenshots.

There are many other clones of vi that may be of interest. These include nvi, elvis and viper-mode (vi-emulation mode in Emacs). For a list of these, see All about VI and its clones.

7.2.4  Other Sources of Information.

There is a multitude of information on Vi on the World Wide Web. Some notable websites are:

On Usenet, vi people usually hangout on the comp.editors newsgroup.

7.3  Summary.

I hope I have been able to convey to you the compelling reasons for learning vi. Vi is one of the most powerful and versatile editors with an abundance of features such as macros, and filter and scripting support. On top of this, vi is available on just about every Unix installation, and is very lightweight.

8  Closing words.

I have attempted to give a fair introduction to the various editors available on the SOCS system. Each editor has its own set of advantages and disadvantages, and in the end it is up to you to weigh your needs and choose what is best for you. Despite popular belief, editors are a means to an end, not a religion.

And, finally, if you have any suggestions on how this article could be improved, please do not hesitate to email me.

9  Thanks and Acknowledgements.

I would like to thank the following people:

Material in this article has been taken from or inspired by the following sources:

This guide was originally written in LATEX with the editor XEmacs. The HTML was generated with TtH and hand-edited as necessary. Versions of the guide were managed with PRCS.


Footnotes:

1 A file is a collection of letters, numbers and special characters: it may be a program, a database, a dissertation, a reading list, a simple letter etc.

2 Since UNIX is actually a trademark, I will use Unix (note capitalization) to refer to UNIX-like OSes such as Linux, Solaris and FreeBSD.

3 So why call it Meta then? Presumably, keyboards once actually did have a key labelled Meta. If you wish to find out more, try asking about it on comp.emacs or alt.religion.emacs.

4 A buffer is a temporary area in memory where a copy of the file contents are stored. Any changes you make here will not affect the file on the disk until you instruct the editor to save the changes.

5 TECO: Text Editor and COrrector, originally Tape Editor and COrrector

6 ITS: Incompatible Time-sharing System

7 Advanced: You can use the -q option for the moment in order to get around some crud the sysadmins have found necessary to enforce on everyone by default. Amongst other disagreeable things, the system default disables C-z as suspend. If you are curious as to why this was done, the reasons are mostly historical and do not really concern anyone except the older folks using the system. -q will tell Emacs not to load any init files but you can also use the -l <filename> option in conjunction in order to load your personal customizations.

8 If you are lucky, XEmacs (section 5.2.4) will now be available on the system. To run XEmacs instead of Emacs, type xemacs.

9 If you do not want this window, invoke Emacs with the -nw option.

10 One of the most irritating stupidities of Emacs is that the Backspace key does not work as expected by default. It invokes help (you can press C-g to abort it). I mention ways around this in the Advanced section (section 5.2.5).

11 For example, see the Emacs Lisp Repository or gnu.emacs.sources.

12 Note that you can use TAB to help you complete the command. Try typing M-x foTAB and you will find Emacs will either fill in the rest of the command or present you with a list of the different possible alternatives.

13 Personally, I took this course when Prakash Panangaden was teaching it. Please check the course webpage and the standard sources for the most up to date information on the course.

14 You may want to start your search at /usr/local/pkgs/ or /usr/local/pkgs/gnu/. Look for the Emacs or XEmacs subdirectories and find the files with extension .el.

15 I should note here that Emacs 20.3 was recently announced and probably contains features that the current XEmacs 20.4 does not.

16 Especially those of us without overly-large hands.

17 You could of course put this command in your shell's start-up file so that you do not have to type it every time.

18 See the environment variables EDITOR and VISUAL.

19 If you are lucky, VIM will be available (section 7.2.3). Type vim or vim <filename> instead to use it.


File translated from TEX by TTH, version 1.58.