Best of Vim Tips
rayninfo.co.uk
rayninfo.co.uk
I've concluded that vim has every feature I can imagine - and then some. But I can't appreciate it until I've imagined it. The problem is that it is impossible to find that feature in the help, since I don't know its name. Google helps here, by searching for a description of it in my own words.
Every tutorial I've ever seen on vim is mind-bogglingly boring. I've learnt the most by just hearing one tip at a time - and searching for one when I need it.
Some people can absorb massive quantities of raw information, but I need to integrate new information into my other knowledge in order to be able to use it. Then there's practicing the habit of using it, and learning in what situations it is appropriate. For a tool, it's not knowledge per se, but the application of knowledge that is useful.
I need it for appending to text I've searched for, especially if I need to do it a few times. e.g. for adding an argument to a few method calls. I usually go `n` (repeat the search), then `e` (go to the end).
That's enough. One tip at a time maxes out my absorption rate.
One of my favorites that has saved me a ton of time more than once:
" rename a string with an incrementing number
:let i=10 | 'a,'bg/Abc/s/yy/\=i/ |let i=i+1 # convert yy to 10,11,12 etc
When does a collection of items go from a list of tips to a lengthy compendium of details?
Like others, I started looking over the page and got discouraged; there's too damn much.
between mark a and mark b: 'a,'b
goto lines containing Abc: g/Abc
recognizable substitute: s/yy/\=i/
= prefixes a variable (escaped with \)
A problem is that it will only replace the first `yy` on the line (if you add g, to make it s/yy/\=i/g, it replaces all of them, but with the same value of i.How to make it increment multiple yy's on the one line?
In order to help myself (and others so interested) to improve my German vocabulary I set up a Twitter account that shoots off random German - English word definitions: @TeachMeGerman. Every hour you can learn a new word (modulo the data set size, though the repetition is actually handy).
I bet such a thing, if it does not already exist, would be good way to pick up new vim tips.
Thoughts?
Volunteers? :)
This way I didn't have to remember to do anything. :)
I love it as it is.
'a,'bg/fred/s/dick/joe/igc : VERY USEFUL