VIM rc file stuff


To be honest, I prefer a good GUI IDE for development projects. MSVC 6 with Visual Assist X rocks for C++. For the Rails development I do on my windows laptop, however, I just use a combination of Scite, standard Windows explorer, and a cmd window. It isn’t Textmate, but it isn’t bad either. I’ve tried Eclipse, but it usually lets me down. It is confusing to install. It can be confusing to import an existing project. It may not even do what I need. It is too complex to configure. It is also quite large (ie. slow). If it had a new killer feature, I might reconsider it in the future.

Occasionally, though, I need to work on the Unix box that has our code. This means that I need a decent editor under Unix. This means Vim.

Vim is really good at dealing with all the different file types out there and providing support for syntax highlighting as well as proper indentation and completion. Recently, I had to create a .vimrc file in order to edit some code and get the spacing properly set.

Here are some good links for that:

A great page on using VIM for Ruby and Ruby on Rails. Interesting sections on using VIM as and IDE (relevant for other languages as well)

A nice small blog post on a vimrc

A nice complicated example

When I setup my vimrc, I always turn off tabs for everything except makefiles. The vimrc is expressive enough to handle conditionals based on the file type involved. For example, here is one of my .vimrc files (I have several similar files on various accounts). Notice how it is setup for Python, but was easy to pull off the necessary differentiation just for ruby.

set nocompatible " We're running Vim, not Vi! syntax on " Enable syntax highlighting filetype on " Enable filetype detection filetype indent on " Enable filetype-specific indenting filetype plugin on " Enable filetype-specific plugins

set tabstop=4 " tabs are 4 spaces! set shiftwidth=4 " tabs are 4 spaces! set expandtab

set pastetoggle=

au BufNewFile,BufRead Makefile set noexpandtab au BufNewFile,BufRead makefile set noexpandtab

colorscheme elflord

augroup ruby autocmd BufReadPre,FileReadPre *.rb set tabstop=2 autocmd BufReadPre,FileReadPre *.rb set shiftwidth=2 augroup end

This entry was posted in Computers, General. Bookmark the permalink.

Leave a Reply

Your email address will not be published.