Re:Graphical Vim Cheatsheet
by bostonvaulter2 on Tuesday December 14, 2010 @02:08PM
(#2005297)
Here's a great SO comment describing how to work with text objects:
http://stackoverflow.com/questions/1218390/what-is-your-most...
I consider text objects and the f/t motions to be the core Vim editing motions. I'm always annoyed that vim intros go through teaching the w/e/b motions when you can easily get by with f<space>/t<space>/T<space> and the search commands generalize to things like replacing the first part of a camelCase word (ctC) or the end of a string (ct").
Working with text objects like that really boost the ability to work effortlessly ... and is, like you said, something the cheat sheet doesn't mention.
Then again, the cheat sheet leaves a lot out ... but it's the fundamental tool for a newcomer regardless... ideally, they should become intimate with ":help".
Re:Graphical Vim Cheatsheet
by monk_the_dog on Tuesday December 14, 2010 @02:48PM
(#2005469)
If you use emacs/viper, I recommend vimpulse: http://www.emacswiki.org/emacs-es/Vimpulse
This gives you text objects - and they are fantastically useful. It also gives you the saner window functions of 'C-w hjkl'
I've been trying to learn the emacs way of doing things, without resorting to Vim emulators, but this is really tempting.
One question, how well do these work with say Paredit mode? Paredit really hates it if you change a parenthesis via some other function. If they get unbalanced paredit has a seizure.
What? How is that useful?
'das' deletes a sentence under the cursor. 'dap' deletes a paragraph under the cursor.
'da{' deletes the block of text that's currently surrounded by braces. 'ci(' deletes the inner content that's surrounded by parentheses and puts you in insert mode. 'gqap' reformats the contents of the paragraph under the cursor ('gqip' will end up leaving your cursor at the beginning of the paragraph instead of the end.)