What's the best thing you've done with vim that helped your programming?


What's the best thing you've done with vim that helped your programming?



While surfing, I came to know that somebody has done Tower of Hanoi using vim. WOW!!!

Can you people share what all cool things you have been doing in vim.

Edit: Not sure about the Tower of Hanoi solution using vim being all that useful. But I think this question should be re-opened to allow people to comment on any useful things that they've done using vim. For me? See my answer below. (-:




Find and Replace within selection in `vi`

1:



vi / vim - how to set the tab label/title length to a fixed size in chars
vim has a set of commands that integrate with development tools such as make, gcc, and ctags.


how can i get the word under the cursor and the text of the current line in vim script?
You can build your project, navigate to warnings and errors, and jump to function/variable definitions without leaving the editor:.
What is logical AND in Sed/Vim?
  • :make builds the project.


    Vim 80 column layout concerns
  • :cl lists warnings and errors.
  • :cc takes you to the to line in the source code that generated the current error.
  • :cn navigates to the next error.
  • :cp navigates to the previous error.
  • :tag name navigates to the definition of the token name.


    Vim customization — .vimrc — mapping of keys
    (See man ctags to generate an index of tokens; sometimes make tags will do this automatically.)
  • Pressing Ctrl+] navigates to the definition of the token under the cursor.


How can I convert a decimal number to hex in VIM?


vim with ssh and putty … broken syntax coloring after windows paste

2:


I'm using vim to syntax-color code in my blog and lecture notes.

A single Perl line.
system  "$vimrt\\gvim.exe", qq{    -c "edit /tmp/tmpcode.$ext "    -c "source $vimrt/syntax/2html.vim"    -c "write! /tmp/tmpcode.html"    -c "qa!"}; 
converts the code into nicely-colored HTML.

I know there are stand-alone tools for doing this, but vim is already installed on my system, so this is one less tool to install..


3:


I found myself struggling to be more efficient in vim compared to other non-modal text editors until I learned about "text-objects".

Understanding this concept really improved my productivity and also gave me a new way of looking at text which in turn made it easier to deeply understand other vim concepts that I had only understood ephemerally before.. :help text-objects.


4:


I was working on a system that had massive log files.

We're talking 30,000 10MB logs.. Per day!. Distinguishing between log messages that were coming from the middleware (same company but custom rolled) and our application was getting tedious.. That is until I wrote some custom vim syntax parsing so that anything vim displayed in green was from the middleware (done by the guys in Sophia Antipolis near Cannes) as opposed to anything vim displayed in blue that was from our application software that sat over the top of the SA code.. I also added highlighting to really make exceptions stand out with white lettering on a read background!. Made life so much easier! And it wasn't that hard to do!. Thanks vim!.


5:


I couple of months ago I wrote a vim script to save a complete history of all my edits, so I could inspect and measure my programming performance..


6:


I'm using vim a lot recently to edit XML files.

I got the xmledit plugin for vim working.

Now vim creates closing tags for me, I can enclose highlighted text in an XML tag, and jump to balancing XML tags.

It saves a lot of repetitive typing, reduces mistakes, and increases my productivity..



88 out of 100 based on 88 user ratings 238 reviews