Keyboard kung fu
Now that we have Vim all set up, it's time to learn some more command line shortcuts. The first thing we will be looking at is indentation.
Indentation can be done in Vim by going into visual mode and typing V for selecting portions of text or V for selecting full lines, followed by > or < to indent right or left. Afterwards press .
to repeat the last operation:
Any operation can be undone by hitting u
and can then be redone by hitting Ctrl + R (as in undo and redo). This is the equivalent of Ctrl + Z and Ctrl + Shift + Z in most popular editors.
When in visual mode, we have the option of changing the case of letters by hitting U to make all text upper case, u for lower case and ~ to reverse current case:
Other handy shortcuts are:
G
: Go to end of filegg
: Go to start of fileSelect all
: This is not really a shortcut, but a combination of commands:gg V G
, as in go to start of file, select full line, and move to the end.
Vim also has a handy shortcut for opening man...