Useful Vim Commands for SAS Administrators on UNIX

By | January 29, 2010

After a successful installation of SAS Enterprise BI Server on my Sun Servers, a certain amount of time is spent modifying configuration files and backup scripts, as well as browsing log files.  I use the vi editor to accomplish the editing.  I used used vi a lot back when all of my GIS work was performed in the UNIX environment, but once the Intel hardware matured and the GIS tools because available on Windows, I thought I would be able to forget all about the UNIX command line.  Wrong.  I’m back there again, but now I’m armed with a cheat sheet:

Working with files

Vim Command


vi filename

Opens a file with the Vim editor.

:w filename

Save changes to a file. If you don’t specify a file name, Vim saves as the file name you were editing. For saving the file under a different name, specify the file name.


Quit Vim. If you have unsaved changes, Vim refuses to exit.


Exit Vim without saving changes.


Write the file and exit.

Moving around in the file

Vim command


j or Up Arrow

Move the cursor up one line.

k or Down Arrow

Down one line.

h or Left Arrow

Left one character.

l or Right Arrow

Right one character.


To the beginning of a line.


To the end of a line.


Jump to line number n.

Inserting and overwriting text

Vim command



Insert before cursor.


Open a new line below and insert.


Open a new line above and insert.


Change the rest of the current line.


Overwrite one character. After overwriting the single character, go back to command mode.


Enter insert mode but replace characters rather than inserting.

The ESC key

Exit insert/overwrite mode and go back to command mode.

Deleting text

Vim command



Delete characters under the cursor.


Delete characters before the cursor.

dd or :d

Delete the current line.

Undo and redo

Vim command



Undo the last action.


Undo all the latest changes that were made to the current line.

Ctrl + r


There are obviously many more Vim commands out there.  Typically if I find myself in a situation where extensive modifications need to be made with a text editor, I will use Crimson Editor on Windows.

The list of commands above are a subset of The Vim commands cheat sheet – 1.2.

Leave a Reply

Your email address will not be published. Required fields are marked *