I thought I might sit down and document some key ways that I interact with vim, and then I realized that would take a couple hours and way more thought than I want to put into a drunken Saturday night. So I decided to talk only about targets instead.
In vim are the concepts of actions and targets. Actions are pretty straightforward and are really only useful when combined with targets. Some actions in vim are listed below for reference.
- d: delete
- y: yank (copy)
- c: change
- v: select
- iw: in word
- t: to the character before the next character entered
- f: to the next character entered
- $: to end of line
- ciw: change in word. Whatever the word under the cursor, remove it entirely and put me in insert mode.
- diw: delete in word. Delete the entire word currently under the cursor.
- ct.: change to the next period. Helpful for changing the name of an object, but not the method called on it.
- ct(: change to the next open paren. Helpful for changing the name of a method.
- df): delete to next close paren. Helpful for deleting entire method calls.
- yiw: yank in word. Yank the entire word under the cursor.
- d$ or D: delete to end of line
- c$ or C: change to end of line
- y$: yank to end of line

3 comments:
I use (y|c|d)i in combination with arbitrary enclosures (parens, brackets, quotes) a lot. e.g.: ci"
Nothing ground breaking but I use it all day, every day.
voxdolo: Wow, that's really cool. I will start training myself on that one immediately. I always had it in the back of my head that i should be more useful than it currently is for me.
Thanks Veez! Very helpful quick guide for a VIM Padawan like me.
Post a Comment