Think of actions as sentences and commands as words in that sentence: verbs, objects, prepositional phrases, modifiers grouped in that sentence according to a grammar that (like most grammars) has its corner cases but makes a lot of sense overall. Hell, Vim even has transitive and intransitive verbs!
The basic rules are really quite simple:
{count}operator{motion}
{count}operator{text-object}
If you have a clear idea of the action you want to perform, using Vim's language is almost friction-less.
"Cut this block of lines and paste it below the function signature." could become:
dip " cut this paragraph
?func<CR> " move the cursor to the first func above
p " paste
instead of the incredibly convoluted:
<Home> " move the cursor to the start of the line
<Shift><Down><Down><Down> " select the block I want to move
<C-x> " to cut the selection
<Up><Up><Up><Up><Up><Up><Up> " move up to the target
<End> " move the cursor at the end of the line
<CR> " open a new line
<C-v> " (finally) paste those lines
(edit)
The example above stands as a good illustration of the beauty of Vim's editing model: there's very little to none "delta" between what you think and what you actually do. In more traditional editors, that "delta" can be huge because of all the completely unrelated steps necessary to perform a given task. Because using Vim is like speaking a language with your fingers, you only have to think in that language to be efficient. What you gain from that is more than speed.
(endedit)
"Paste 6 times." becomes the awesome:
6p " paste 6 times
instead of:
<C-v><C-v><C-v><C-v><C-v><C-v>
Other interesting rules:
- lowercase motions (
bwe
) work on keyword characters-delimitedwords
, - uppercase motions (
BWE
) work on whitespace-delimitedWORDS
, - some uppercase operators (
FTP
) work just like their lowercase counterparts but in the opposite direction, - some uppercase operators (
IA
) work like their lowercase counterparts but on the extremities of the line, - some other uppercase operators (
YCDVS
), like doubled lowercase operators (yyddcc
) are shortcuts for very commonoperator{motion}
sentences…
Glts has written an awesome article on the subject.