Friday, September 03, 2004

VIM: Capable of doing Anything, Everything and More.

I've been using vim for more than 5 years now.
And, I've been learning vim ever since.
I just came across this taglist plugin of vim. Now vim even looks like an IDE ! I remember, the first time I saw this build-edit-rebuild feature I was flabbergasted.
vim test.c
write some erroneous C code
:w
:mak test
then just doing :cn u can jump through the line of code having next error. Likewise :cc for current & :cp for previous error.

I think I saw GOD that day.
Here are some vim features I cannot live without. But, If this is the first time you're trying any one of these, today is the day of your enlightenment. Faint hearted dont gulp it all at once !
Shift K for manpage on the text under cursor.
:set smartindent - makes life easier.
% - to match the brace. >% - on a brace '{' right indents.
* - search for word under cursor.
:Ex - for file explorer in split window.
Ctrl ww - to switch between split windows. :res N to resize the focussed window to n lines in split window mode.
gd & gD - for goto definition of the word under cursor in the current function and current file.
:r filename - copy entire file at the cursor position.
:e filename - edit another file(current file goes in buffer)
:ls - list the files in buffer and :e#N to goto Nth file in the buffer
:Nsb - open Nth file in the buffer in split window.
gf - to goto filename under cursor in the current directory
ma - set a mark at this line and name it a then 'a to goto mark and y'a to copy text from between current cursor position and the mark.Likewise mb, mc, mA, mB, mC etc for more marks.
Ctrl n - (in insert mode)for word complete.

Call it serendipity that I stumbled upon the cscope plugin while trawling aimlessly thru web. Believe me, its a life changing experience. I wonder if this will ever end.
I haven't still tried ctags,key maps, registers, gdb plugin,cvs plugin the list goes on and on and on ...
Its impossible to even know all of what I dont know in vim.
By the way if you are lost, vim will help you with 'the answer to life,the universe and everything'.
Try these, its fun ...
:h 42
:h holy-grail
:help!

... and some people still say emacs is better ? I found this ...
Emacs is a nice OS, but it lacks a good text editor. That's why I use Vim.
Ditto.

5 Comments:

At Fri Sep 03, 08:29:00 AM GMT+5:30, Blogger Ananth Narayan said...

Emacs, i hear stands for Emacs Makes A Computer Slow!!

 
At Fri Sep 03, 09:51:00 AM GMT+5:30, Anonymous Anonymous said...

"Now vim even looks like an IDE!" Now what do u mean by that. Vim was always an IDE ;)

 
At Fri Sep 03, 11:51:00 AM GMT+5:30, Blogger Praveer said...

I agree it alwayz was. Now it even looks like a GUI IDE like .NET etc with files and keywords coming in splitwindow.
see this link to know what I'm saying:
http://www.geocities.com/yegappan/taglist/images/taglist_perl.gif

And hey I forgot to mention code folding. When it comes to features vim is an inspiration to .NET

 
At Fri Sep 03, 06:38:00 PM GMT+5:30, Blogger a_beautifulmind said...

Informative!! Will like to c sm more posts like this in future. :-)

 
At Sun Sep 05, 11:50:00 AM GMT+5:30, Blogger a_beautifulmind said...

h 42 one is really cool.I had never tried it on VIM!!

 

Post a Comment

<< Home