Contact UsComputer Science Department
500 College Avenue
Swarthmore, PA 19081
Email: info at cs.swarthmore.edu
Copyright 2009 Swarthmore College. All rights reserved.
This is one of two commonly used editor. It is the editor that is found on all UNIX machines. One way that vi differs from emacs (the other commonly used editor) is that you must enter the command "i" to get into insert mode, which emacs is in all the time. There is also vim, Vi IMproved, a programmer's text editor and gvim, a graphical/gui version of vim that looks a lot like emacs. Run man vim for more information and vimtutor for the tutorial. To run vim, just enter vim. To run gvim in an xwindows environment (which we have in the CS Lab), enter gvim at your unix prompt.
Where to get more vi information:
- vi reference card
- vi lovers home page
- basic vi commands
- our vim tips and tricks page
- extensive vi reference
Another commonly used editor on the UNIX machines is called GNU Emacs . Being able to use the emacs editor effectively will help you write your programs, find errors, and correct them more efficiently. Also, the conventions you learn to use with Emacs can be applied to other programs, such as browsers and command-line editing.
Many people like to use xemacs, which is closely related to emacs.
Emacs and xemacs provide a tutorial. At the unix prompt type xemacs to enter the editor. Once in xemacs, press Ctrl-h and then t for the tutorial (or just use the menu options: Help-->Tutorial).
LaTeX (pronounced "lah-tek") is a formatter. You can use any of the above editors to create a text file with formatting instructions in the document that latex can understand, similar to the way you format in html for web pages. LaTeX is good for writing a thesis or papers with lots of math equations.
Where to get more latex information:
- step-by-step LaTeX tutorial
- intro to LaTeX
- some examples:
- writing reports in LaTeX
Changing your default editor
UNIX uses the EDITOR and VISUAL environment variables to determine your default editor. For example, when using mutt or pine, when you get to the part where you type in your mail message, they will start up your default editor.
To see what your default editor is set to, try this:
$ echo $EDITOR vi $ echo $VISUAL vi
If you want to change these, try this (from the bash shell):
$ export EDITOR=vim $ export VISUAL=vim
If you want to change these permanently, edit your .profile file.