Editing with vi in terminal

From Amahi Wiki
Revision as of 19:06, 4 July 2009 by Bk (talk | contribs) (New page: == This page is somewhat of a tutorial on how to use the command line text editor "vi". Its pretty simple once you read over this. == = Open up a file with vi = To open a text file to ed...)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Open up a file with vi

To open a text file to edit with vi type the following into your terminal:

vi file

Have the ability to add/delete text from the file

To insert text into the file you just opened, just hit the "i" key on your keyboard and start editing.

Saving a file

To save a file, hit the "Esc" key on your keyboard and then type the following:

:wq

The w is for "write" or "save", and the q is for "quit" to quit vi.

Oops I messed up, how do I revert my changes?

Sometimes you will mess up when editing a file and not remember where you went wrong, so you want to start over, its simple, follow the command to exit editor mode (hit your "Esc" key on the keyboard) and type the following:

:q!

The q tells vi to quit and ! tell it to "quit without saving".


If I have missed anything, feel free to edit this wiki page, but please leave the current in tact.