Related link: http://www.vim.org/

Doing a new project in Rails, I started using vim when putting it together, then a couple weeks went by, and I never got out of vim!

I used to use GUI-based editors with syntax highlighting, code hints and such - until I found that vim can do all of that! Once I figured out how to make it automatically close all my parens, braces, and brackets, I was sold.

Here’s my favorite .vimrc thing that helped….

Put this in ~.vimrc

:inoremap ( ()<ESC>i
:inoremap ) <c-r>=ClosePair(')')<CR>
:inoremap { {}<ESC>i
:inoremap } <c-r>=ClosePair('}')<CR>
:inoremap [ []<ESC>i
:inoremap ] <c-r>=ClosePair(']')<CR>
function ClosePair(char)
  if getline('.')[col('.') - 1] == a:char
    return "<Right>"
  else
    return a:char
  endif
endf

The other thing that helped a lot was konsole. I like to full-screen all my terminal windows. Never fond of having lots of little boxes floating around. So, when in a Rails dev-mood, I open up a tab at the bottom for EACH of these:

  • project
  • model
  • view
  • controller
  • lang
  • database (pg/mysql console)
  • Rails/ActiveRecord console
  • misc
  • log

I just [SHIFT]-arrow back-n-forth between them, each one taking the full screen, and getting my full attention while working.