[SATLUG] RE: Tweeks Advanced "Vim" For Developers

Tweeks tweeksjunk2 at theweeks.org
Sun Aug 30 00:08:08 CDT 2009


On Saturday 29 August 2009 04:43:09 am Robert Pearson wrote:
[...]
> Do you have any information you can share on the configuration of the
> "vim" you are using?
> Is the "vim" advanced (like an IDE for Ruby) or is it just the editor
> of choice for the project?

You mean vimenhanced?  Well yea.. you want that to get all the bells and 
whistles.. Most distros don't seem to come with anything bug vim-tiny 
(Debian) vim-minimal.   But I recommend you get:
	(in Debian/Ubuntu)
	vim-common
	vim-doc
	vim-full (or vim-gnome)
	vim-gtk (all the ruby, tcl, python context stuff)
	vim-runtime
	vim-scripts

On RPM systems.. umm.. I think it was like:
	vimcommon
	vimenhanced
	vimscripts
or something along those lines (haven't done RHat in many moons now). Anyone 
RH geeks want to jump in.. please do.  Just do a "yum search vim" and have a 
look and install most of it and you'll be good. :)

The first thing you will want to give your vim folks is the vim cheat sheet:
	http://www.digilife.be/quickreferences/QRC/VIM%20Quick%20Reference%20Card.pdf

If these are developers, then you'll also want to make sure that they check 
out vimdiff. Very cool for comparing code versions.  It can even compare a 
local file to a remote file (via http or ssh based with keys-auth set up)!

One thing developers will also want is the ability to generate ctag files for 
content or projects that you're working on (install ctags or etags packages).  
For example.. if you DL wordpress or some such PHP code system, you can CD 
into the wordpress php/html casebase and run a "ctags -R *" to recursively 
generate a ctags file that will empower vim to hypertext jump between code 
files/functions that reference eachother (usting CTRL-] and CTRL-t for 
navigation).  VERY cool.. more info here:
	
http://www.thegeekstuff.com/2009/04/ctags-taglist-vi-vim-editor-as-sourece-code-browser/
	http://vimeo.com/4007386


Also check out code folding:
	http://vimeo.com/4020903
	http://showmedo.com/videotutorials/video?name=3160060&fromSeriesID=316

Wow.. That vimeo.com site ROCKS! If you have devs, definately have them poke 
through that site to get warmed up. :)

Supposedly one of the best books on really tweaking out your vim setup 
is "Hacking Vim":
	http://www.amazon.com/dp/1847190936

BTW.. just for the record.. I am NOT a "vim guru".  Most of my foo comes from 
the all knowing David Roth ("the vim guru" at Rackspace :)  
Most of the cool stuff I do in vim came from him at one time or another. :)

Although, one web-admin trick that I DID actually show him once was vim's 
ability to process files using "vim scripts".. think of them as file based 
macros.

So if I wanted to seach through an html file for ever ocurrance 
of "tweeks at example.com" and replace it with "tom at example.com", I can simply 
create a file called "tweeks2tom.vsh" that has this in it:
	:%s/tweeks at example.com/tom at example.com/g
	:w!
	:q

and then invoke it like this:
	vim -s tweeks2tom.vsh index.html

The cool thing is that conbined with find, it becomes VERY powerful:
	find /var/www/ -name "*.html" -exec vim -s tweeks2tom.vsh {} \;

and watch it fly! (it really is quite cool to watch visually!  much more 
exciting than sed ;).

Anyway.. I've yammered enough..  hope some of this helped someone.

Tweeks
p.s. for the record.. vim, the best editor on the planet, was actually written 
on and for the Amiga platform in 1988  :)
	http://en.wikipedia.org/wiki/Vim_(text_editor)
Long live Amy!


More information about the SATLUG mailing list