Found the coolest tips today, involving motion commands. Was spurred by a comment from some random weblog (Frymaster?).
First start with hjkl0$
. These are the basic motion (movement) commands. Then get more advanced with “f<letter>
” (Find letter, forwards). F
goes backwards. Then I found out about t
/T
(unTil).
The neat thing about Vi (and Vim) motion commands is that you can use them with vydc
, so df.
is “delete until find period”. Now I have dt.
, “delete until period”. Someone suggested (thank you Anonymous Hero) looking through the :help motion.txt
sections. Wow, I never suspected that there were such interesting commands in there!
So, the neat thing is that once you’ve started a command that expects a motion (like dyc
, etc.) you can utilize a new set of motion commands that aren’t normally available. Without further ado, here’s nice list.
:help motion.txt
viB
— select inner block (brace-fu)
vaw
— select a word
v3aw
— select 3 words
vas
— a sentence!!
vap
— a paragraph!
va}
— the next brace-foo
va)
— the next paren-foo
Again, these all work with dyc
, etc. If you’ve got some C-like code lying around, try the following. In between some paranthesis (function calls, etc) try the two following:
di)
— delete inside the paren-thing
da)
— delete all the paren-thing
Or c
, v
, y
, as you see fit, or }
, or iB
brace/function-fu
Writing this while Bush is speaking in the State of the Union address, he seems a lot more knowledgeable, lots of good ideas in there, maybe he’s got his ornery up now and is willing to spend it all without fearing the need to get re-elected? Hopefully he doesn’t mess it all up. Renewable energy? Who would have thought? Gotta back those words up with actions, though.
20:28 CST | category / entries
permanent link | comments?