File Editors


Four file editors are supported on all SGI workstations: vi, nedit, jot, and xcoral.

In addition, other editors (e.g., emacs, jed, joe) MAY be available on SGI workstations in individual research labs; these editors must be installed on the local workstation, so they are not available via the departmental servers. For example, emacs v19.30 is locally installed and available on pchem01-06, splatter, and stereo1-3. If you want to use an editor that is not currently installed on your local workstation, contact your primary system administrator or the MolViz Facility staff.

To use one of these editors, type:

jot is the default file editor for SGI applications. This graphical editor is similar to a basic word processing program. Click on Options/Long Menus to expand the list of options available in each pull-down menu. Experience has shown that this editor is the least prone to crashes.

nedit is a graphical editor that is similar to jot (with Long Menus), with a few extra UNIX commands built into the editor.

xcoral is yet another graphical editor that is similar to jot (with Long Menus), with "modes" for C, C++, Fortran, PERL, Latex, Ada, etc.

vi is a screen editor that is popular on all UNIX workstations. See the following vi guides:

From the vi man page:

In the descriptions, CR stands for carriage return and ESC stands for the escape key.

Sample commands
<- v ^ -> arrow keys move the cursor
h j k l same as arrow keys
itextESC insert text
cwnewESC change word to new
easESC pluralize word (end of word; append s; escape from input state)
x delete a character
dw delete a word
dd delete a line
3dd delete 3 lines
u undo previous change
ZZ exit vi, saving changes
:q!CR quit, discarding changes
/textCR search for text
^U ^D scroll up or down
:cmdCR any ex or ed command

Counts before vi commands
Numbers may be typed as a prefix to some commands. They are interpreted in one of these ways:
line/column number z G |
scroll amount ^D ^U
repeat effect most of the rest

Interrupting, canceling

File manipulation
ZZ if file modified, write and exit; otherwise, exit
:wCR write back changes
:w!CR forced write, if permission originally not valid
:qCR quit
:q!CR quit, discard changes
:e nameCR edit file name
:e!CR reedit, discard changes
:e + nameCR edit, starting at end
:e +nCR edit starting at line n
:e #CR edit alternate file
:e! #CR edit alternate file, discard changes
:w nameCR write file name
:w! nameCR overwrite file name
:shCR run shell, then return
:!cmdCR run cmd, then return
:nCR edit next file in arglist
:n argsCR specify new arglist
^G show current file and line
:tag tagCR position cursor to tag (see ctags(1)), save position
:popCR return to previous tag's position

In general, any ex or ed command (such as substitute or global) may be typed, preceded by a colon and followed by a carriage return.

Positioning within file
^F forward screen
^B backward screen
^D scroll down half screen
^U scroll up half screen
nG go to the beginning of the specified line (end default), where n is a line number
/pat next line matching pat
?pat previous line matching pat
n repeat last / or ? command
N reverse last / or ? command
/pat/+n nth line after pat
?pat?-n nth line before pat
]] next section/function
[[ previous section/function
( beginning of sentence
) end of sentence
{ beginning of paragraph
} end of paragraph
% find matching ( ) { or }
^] :tag command using word after the cursor as the tag
^T return to previous tag's position (:pop command)

Adjusting the screen
^L clear and redraw window
^R clear and redraw window if ^L is -> key
zCR redraw screen with current line at top of window
z-CR redraw screen with current line at bottom of window
z.CR redraw screen with current line at center of window
/pat/z-CR move pat line to bottom of window
zn.CR use n-line window
^E scroll window down 1 line
^Y scroll window up 1 line

Marking and returning
`` move cursor to previous context
'' move cursor to first non-white space in line
mx mark current position with the ASCII lower-case letter x
`x move cursor to mark x
'x move cursor to first non-white space in line marked by x

Line positioning
H top line on screen
L last line on screen
M middle line on screen
+ next line, at first non-white
- previous line, at first non-white
CR return, same as +
v or j next line, same column
^ or k previous line, same column

Character positioning
^ first non white-space character
0 beginning of line
$ end of line
l or -> forward
h or <- backward
^H same as <- (backspace)
space same as -> (space bar)
fx find next x
Fx find previous x
tx move to character prior to next x
Tx move to character following previous x
; repeat last f F t or T
, repeat inverse of last f F t or T
n| move to column n
% find matching ( { ) or }

Words, sentences, paragraphs
w forward a word
b back a word
e end of word
) to next sentence
} to next paragraph
( back a sentence
{ back a paragraph
W forward a blank-delimited word
B back a blank-delimited word
E end of a blank-delimited word

Corrections during insert
^H erase last character (backspace)
^W erase last word
erase your erase character, same as ^H (backspace)
kill your kill character, erase this line of input
\ quotes your erase and kill characters
ESC ends insertion, back to command mode
DEL interrupt, terminates insert mode
^D backtab one character; reset left margin of autoindent
^^D caret (^) followed by control-d (^D)
backtab to beginning of line
do not reset left margin of autoindent
0^D backtab to beginning of line
reset left margin of autoindent
^T shiftwidth spaces.
^V quote non-printable character

Insert and replace
a append after cursor
A append at end of line
i insert before cursor
I insert before first non-blank
o open line below
O open above
rx replace single char with x
RtextESC replace characters

Operators
Operators are followed by a cursor motion, and affect all text that would have been moved over. For example, since w moves over a word, dw deletes the word that would be moved over. Double the operator, e.g., dd to affect whole lines.
d delete
c change
y yank lines to buffer
< left shift
> right shift
! filter through command

Miscellaneous Operations
C change rest of line (c$)
D delete rest of line (d$)
s substitute chars (cl)
S substitute lines (cc)
J join lines
x delete characters (dl)
X delete characters before cursor (dh)
Y yank lines (yy)

Yank and Put
Put inserts the text most recently deleted or yanked; however, if a buffer is named (using the ASCII lower-case letters a - z), the text t buffer is put instead.
3yy yank 3 lines
3yl yank 3 characters
p put back text after cursor
P put back text before cursor
"xp put from buffer x
"xy yank to buffer x
"xd delete into buffer x

Undo, Redo, Retrieve
u undo last change
U restore current line
. repeat last change
"dp retrieve d'th last delete

vi and ex were developed by The University of California, Berkeley California, Computer Science Division, Department of Electrical Engineering and Computer Science.


Back to  |  Application Guide  |  MolViz Home  |
Send comments to chemvis@indiana.edu
Last updated: 01/23/2001