- <i>How do delete without clobbering the "clipboard" register:</i><p>Delete to the "black hole register", "_". For example:<p><pre><code> "_dd
</code></pre>
- <i>How to enter the solution to a quick math equation while in insert mode:</i><p>Use the "expression register", "=". You can even use variables. For example:<p><pre><code> ^r=5325*30<ENTER>
</code></pre>
- <i>How to edit a macro once you've recorded it:</i><p>Paste, edit, and re-yank its register. For example, hitting "qq" will record to register "q". If you want to edit it, you can do <i>"qp</i>, make your changes, then visually select it and do <i>"qy</i>.<p>- <i>How to access prior contents in the clipboard:</i><p>Use registers 0 - 9. For example, <i>"0p</i> will paste whatever was in the clipboard register <i>before</i> you yanked whatever's in there now.<p>BONUS ROUND:<p>- <i>In command mode, how to insert the word currently under the cursor:</i><p><pre><code> ^r^w
</code></pre>
(That's Ctrl-r, Ctrl-w)<p>- <i>Insert a register's</i> literal <i>contents:</i>
For example, if you have a <i>^m</i> (newline) character in the <i>a</i> register, but you want to input the <i>^m</i> character instead of an actual newline while in insert mode:<p><pre><code> ^r^ra
</code></pre>
- <i>Insert the full path of the filename currently under the cursor:</i><p><pre><code> ^r^f
</code></pre>
(This only works if it's in your 'path' variable, like with <i>gf</i>.)
The two "advanced" topics that I've never bothered to learn, despite my years of using vim, are registers and buffers. Thanks to the answers on SO and the comments here, I think I have a pretty good grasp of registers (the being able to paste yanked text after a delete would have saved me so much god-damn time).<p>So all that leaves is buffers. I've traditionally been using tabs and splits for all my editing multitasking, with NERDTree and Command-T to open new files quickly. Is there anything to be gained from me learning/using buffers at this point? I don't know what benefits they offer, and I've never had any problems with my current tab & split setup.<p>Any buffer evangelists out there that care to chime in?
A great trick I didn't know about was the 0 register. I've lost tracked of the number of times I've copied some text, and then deleted something by mistake not realizing I'd overwritten the default register. I could still have pasted what I wanted with "0p, though.
I use YankRing (<a href="http://www.vim.org/scripts/script.php?script_id=1234" rel="nofollow">http://www.vim.org/scripts/script.php?script_id=1234</a>) which takes care of the problem of remembering yank history. Just map :YRShow to a key and you are good to go.
Vim is the tech equivalent of "line movies." A line movie is one where guys (it's usually guys) throw lines back and forth at each other, usually in the current context. Princes Bride and Real Men are line movies. I love line movies.<p>Vim lets geeks throw "vim tricks" back and forth at each other. I love Vim, and I love vim tricks.<p>Good SO thread, and good HN thread. I never tire of Vim threads.
If you guys are interesting in learning vim more, checkout vimcasts.org. Drew Neil does some really nice walkthroughs that are extremely helpful for beginner and intermediate vim users.