A very short Vim tutorial
Vim is an extremely powerful console editor based on a clever idea:
the keyboard keys can be used both for normal typing (Insert mode) and for
editing actions (Command mode).
You just have to remember that there are these two modes of operation
and how to switch between them!
To switch from Command mode to Insert mode you press
-
i (to type where the cursor is) or
-
o (to create a new line).
To switch from the Insert mode to the Command mode you press [Escape].
At the Command mode you can
-
navigate with the arrows
-
delete with x and X
-
search with /
To exit saving the file, enter the Command mode pressing [Escape] and type :wq. To exit without saving enter Command mode and press :q!.
All will become clear if you type the following on a terminal:
vim hello.txt<Enter>ihello world<Escape>onew line<Escape>:wq<Enter>cat hello.txt<Enter>
That’s all!