Getting started¶
Install it¶
Or keep it around:
From a checkout:
The command line is small on purpose:
turbovi one.py two.py opens two buffers, :bn moves between them. turbovi on its own gives you a scratch buffer. turbovi . is the same as turbovi: a directory is not a file, so the buffer stays empty and the file picker starts there.
The one idea¶
vi has modes, and it starts in normal mode. There the letter keys are commands, not text. j moves down. dd deletes a line. To type text you enter insert mode, and to stop you press Esc.
The status bar tells you which mode you are in. When it says nothing, you are in normal mode.
Five minutes¶
Open a file and try these in order. Press Esc whenever you are unsure: it always returns you to normal mode.
| Do this | What happens |
|---|---|
j k h l |
down, up, left, right |
i then type, then Esc |
insert text before the cursor |
x |
delete the character under the cursor |
dd |
delete the line |
u |
undo it |
| Ctrl+R | redo it |
:w Enter |
write the file |
:q Enter |
quit |
:q! quits without writing. ZZ writes and quits.
The next five¶
Commands compose. An operator plus a motion is one command, and any motion works with any operator.
| Do this | What happens |
|---|---|
w b e |
forward a word, back a word, to the end of one |
dw |
delete a word: d is the operator, w the motion |
d2w |
delete two words |
2dw |
the same thing; the count can go either side |
ci" |
change what is inside the quotes the cursor is in |
yy then p |
copy this line, paste it below |
/thing Enter |
search forwards; n for the next hit |
. |
do that last change again |
Once dw, d2w and ci" each feel like one command, the rest of the key reference reads as a vocabulary to combine, and there is nothing left to memorise.
Where to go next¶
Editing. The grammar in full: operators, motions, text objects, registers, undo, ., macros and marks.
Searching. / and :s in this file, and Ctrl+G across the whole project.
Files and windows. Several files at once, splits, the file picker, and what happens when the editor dies with unsaved work.
Settings. :set, the config file, and .editorconfig.