A Minimal Set of Commands for Vim (Vi)

I prefer nano myself, but lots of experienced Linux users prefer vim (or vi). Sometimes vi is the only editor available, for example on a Pogoplug before you’ve installed Optware and added nano. Here’s an absolute minimum set of commands you’ll need to get going under these circumstances. Start with:

vi filename

Here’s a small subset of vim commands you can use to make changes to the file you opened.

You can move around the file using the arrow keys on your keyboard.
delete deletes the character under the cursor.
R replaces characters with your typing beginning with the one under the cursor
r replaces the character under the cursor with the character you type
i inserts characters before your cursor location
o opens a new line below the one your cursor is on and enters insert mode
esc exits insert or overwrite mode.

Then you can use the following commands:

:w filename
Saves 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.

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

Exits Vim without saving changes.

Writes the file and exits.

  1. Excellent post, however, I found myself wanting to know in case you could write a litte a little more about this subject? I’d be very grateful for those who could elaborate a bit more. Thanks!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: