Saturday, January 10, 2009

VIM: My IDE

Development for me often means simply scripting in Bash, Perl, and Python. Occassionaly I will dive into C to write something. We use Python a lot at work, and so the number of internal libraries and utitlies is numerous. I recently picked up Eclipse with the pydev plugin to see if it would interested me in doing development in it. It worked fine, my only complaints were that I had to execute my scripts in Windows, and I couldn't easily change the color scheme. So I drove further into my already favorite editor: VIM. I added two plugins and changed to a darker color scheme, and voia: I'm very pleased with my VIM configuration now. So I thought I'd share what's in this recipe.

The first is the vim plugin 'supertab'. http://www.vim.org/scripts/script.php?script_id=182 This allows me to do word completion using TAB instead of Ctrl-N. All that is needed is to put the file into the ~/.vim/plugin directory.

Another plugin is the NERD_tree plugin. This places a file explorer 'toolbar' on the left hand side of the screen. http://www.vim.org/scripts/script.php?script_id=1658

I put the plugin into ~/.vim/plugin. And add the following lines of configuration into my ~/.vimrc file so that Control-t toggles the plugin.

"Toggle NERDTree

nnoremap <silent> <C-t> :NERDTreeToggle<CR>

Finally, the last plugin is taglist. http://vim.sourceforge.net/scripts/script.php?script_id=273 This requires that ctags be available. It will highlight classes, functions and global variables and you can use it to jump to the location in the file.

I just droped the plugin into ~/.vim/plugin and added the following lines to my ~/.vimrc file so that Control-y toggles the plugin.

" Toggle Tag List

let Tlist_Use_Right_Window = 1

let Tlist_Sort_Type = "name"

nnoremap <silent> <c-y> :TlistToggle<cr>

The last tweak I made to my VIM was to set the colors darker. A colleague at work forwarded me this theme. http://blog.infinitered.com/entry_files/8/ir_black.vim I made a few small modifications. Fortuantely it is very simple to understand and modify (compared with Eclipse which looked to be a lot more involved).

For this I just droped ir_black.vim into the ~/.vim/colors directory and then added the line below into my ~/.vimrc file.

colorscheme ir_black

No comments: