There are two modes in vim:
- Command mode – you can't write stuff, keys are interpreted as commands.
- Insert mode - it acts like a normal editor, you know you're in insert mode because it says "INSERT" at the bottom.
a
– enter insert mode from command modeESCAPE
– enter command mode from insert mode:w
- save:wq
– quit and savedd
– delete the whole line/
– search for something:e <filename>
– open new file
:split
and:vsplit
- split your screen in twoCTRL-w <arrow>
– change split pane, e.g.CTRL-w-RIGHT
will go to one pane to the right.}
and{
– move cursor one paragraph up or down respectively
vip
– highlight the current paragraphvi{
– highlight everything within the{ ... }
dip
– delete the current paragraphdi{
– delete everything within the{ ... }
ciw
– change the current wordo
– start writing a new line after the current line
See the logic with the vip
, dip
, ciw
?
These were the commands that I got from the top of my head, based on what I usually use. If you think there's something else, that a beginner absolutely has to know to be seduced by vim, fork and add!