vim 101 hacks
Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
Buyer: xiujuan lu (luxiujuan@gmail.com)<br />
Transaction ID: 85W16630AD8515549<br />
Vim <strong>101</strong> Hacks<br />
www.thegeekstuff.com<br />
• We use ! instead of / above because the value of $HOME will contain<br />
at least one / which will confuse the substitution. There are many<br />
characters that can be used instead of /<br />
Example 11. Alter the sequence number in a numbered list when<br />
inserting a new item<br />
Assume that you have a numbered list like the following inside a text file. In<br />
this example, let us assume that you want to add a new line after Article 2.<br />
For this, you should change the number of all other articles accordingly.<br />
vi / <strong>vim</strong> tips & tricks series<br />
Article 1: Vi and Vim Editor: 3 Steps To Enable Thesaurus Option<br />
Article 2: Vim Autocommand: 3 Steps to Add Custom Header To Your File<br />
Article 3: 5 Awesome Examples For Automatic Word Completion Using CTRL-X<br />
Article 4: Vi and Vim Macro Tutorial: How To Record and Play<br />
Article 5: Tutorial: Make Vim as Your C/C++ IDE Using c.<strong>vim</strong> Plugin<br />
Article 6: How To Add Bookmarks Inside Vim Editor<br />
Article 7: Make Vim as Your Bash-IDE Using bash-support Plugin<br />
Article 8: 3 Powerful Musketeers Of Vim Editor ? Macro, Mark and Map<br />
Article 9: 8 Essential Vim Editor Navigation Fundamentals<br />
Article 10: Vim Editor: How to Correct Spelling Mistakes Automatically<br />
Article 11: Transfer the Power of Vim Editor to Thunderbird for Email<br />
Article 12: Convert Vim Editor to Beautiful Source Code Browser<br />
3rd Article “Make Vim as Your Perl IDE Using perl-support.<strong>vim</strong> Plugin” got<br />
missed. So when you want to add it, then you want to change “Article 3″ to<br />
“Article 4″, “Article 4″ to “Article 5″, up to “Article 12″ to “Article 13″.<br />
This can be achieved by the following Vim substitution command.<br />
:4,$s/\d\+/\=submatch(0) + 1/<br />
• Range: 4,$ – From the 4th line through the last line. (the 4 is<br />
manually determined)<br />
• Pattern to Search – \d\+ – A string of digits<br />
135