How To Wiki

How to use vim, quick tutorial

1,795pages on
this wiki
Add New Page
Add New Page Talk0

this is a quick tutorial on howto use vi, or vim. It will get you started, so you open, edit, and save files.

For an interactive tutorial type: vimtutor <ENTER>


Normal mode

When vim starts up, you will be in Normal mode. Normal mode is not for inserting text into your file but allow you to preform many operations, like saving and exiting. Pressing <ESC> will always return you to Normal mode.

Insert Mode

To insert allow you to insert text. Type: 'i to enter insert mode. Press <ESC> to exit insert mode and enter Normal mode.

Basic OperationsEdit

Moving the cursor

The cursor is moved using either the arrow keys or the hjkl keys.

h (left) j (down) k (up) l (right)
Open a File

To open a file(from the % prompt) type: vim FILENAME <ENTER>. To open a file in vim type

<ESC>  :n fileName <ENTER>

To exit Vim type:

<ESC>  :q! <ENTER> to trash all changes.

OR type:

<ESC>  :wq <ENTER> to save the changes.
Edit text

To insert text at the cursor while in Normal mode type:

i type in text <ESC>
  • NOTE: Pressing <ESC> will place you in Normal mode or will cancel an unwanted and partially completed command.

More OperationsEdit

In Normal mode type: u
Return line to its original state
In Normal mode type: <SHIFT>-U
Redo (undo the previous undo)
In Normal mode type: <CTRL>-R
Delete line
In Normal mode type: dd
Delete word(under the cursor)
In Normal mode type: dw
Delete character(under the cursor)
In Normal mode type: x
Delete from the cursor to the end of the line
In Normal mode type: d$
Find word(or string)
In Normal mode type: /theWord <ENTER>

See AlsoEdit


  • parts of this page where derived from man VIMTUTOR(1)

    From HowTo Wiki, a Wikia wiki.

Also on Fandom

Random Wiki