refer to ex manual page for more commands
The vi environment variables
set
You can customize your environment with this command by typing set var=value, this will set the specified var to value for a scalar variable. For Boolean variables, use set var to set and set novar to unset. You can see which variables are set by just typing the set by itsself. You can see a list of all variables by typing set all. Some environment variables are specific to the ex editor and some are specific to the vi editor. I have included both.
Boolean variables:
autoindent(ai) -- begin editing next line at same level of indent-ion as this one.
autowrite(aw) -- write current buffer before leaving
exrc(ex) -- tells vi/ex if it should read the .exrc file in the current directory.
errorbells -- editor sends a beep to the terminal when an incorrect
ignorecase(ic) -- ignore case of characters in searches.
list -- place a $ at the end of each line and a ^I on each tab.
magic -- allow ., [, and * to be interpreted as special characters in RE's.
number(nu) -- number lines in left margin
showmatch(sm) -- when closing a paren., brace or bracket; move the visual cursor to opening item to check scope
showmode(smd) -- show type of insert mode
wrapscan(ws) -- when searching and at bottom of file, continue searching from the top
scalar variables:
shiftwidth -- number of spaces to to insert on a shift operation
File Saving and Loading
:wq -- write file and quit
:w -- write file
:w file -- write to specified file
:w! -- overwrite existing file
:e file -- edit new file
:r file -- put contents of file
:q -- quit the editor
:q! -- force quit the editor, do not save changes
:x -- quit the editor, save file if it was modified
ZZ -- quit the editor, save file if it was modified
Coaxial Networks, Inc. | Page 59 of 60 |