Author: Andres Paglayan

~ 10/08/10

You don’t need a week to switch to vim, one hour can do.

Here’s a quicky for Vim and Rails setup.

1./ Install vim (duh)

2./ Install the rails plugin
>cd ~/Downloads
>git clone git://
>cd vim-rails
>rake install

2./ Install the NERDTree plugin
>cd ~/Downloads (if you weren’t there already)
>git clone
>cd nerdtree
>rake install

(you can delete the original downloads afterward, as the rake task installs the right files in the right place)

3./ edit your ~/.vimrc
> vim ~/.vimrc
a basic one will look like this:

set nocompatible
set autoindent
set smartindent
set showmatch
set ruler
set incsearch
set number
set expandtab
set softtabstop=2
set shiftwidth=2
set tabstop=8
set ignorecase
set smartcase
syntax on
filetype plugin indent on
autocmd VimEnter * NERDTree
autocmd VimEnter * wincmd p

(the two last ones will launch NERDTree by default)

write it with :w

4./ activate the Rails plugin Help
inside vim in command mode run ->  :helptags ~/.vim/doc

5./ quit vim and relaunch it.

6./ read the Rails Help
:help rails

7./ Make your own cheat-card to learn basic navigation, v editing commands,  tab commands, buffer commands and windows commands.

For starters,  you’ll need to know what the following are for:

ESC (back to command mode)
i (insert)
a (append)
o (insert in line below)
A (at the end of line)
u (undo)
h (left)
k (up)
l (right)
j (down)
* (next wd)
# (previous wd)
G (end of file)
(number)G (go to line)
dd (del line)
v (x p | y p) visual cut/yank paste


(tabs are awasome)
:tabe _file_ (edit file in new tab)
:tabm (number)
gt (move to next tab)
gf (edit file under cursor on new tab)

Window controll (all bellow after with Ctrl-w)
s (split)
v (vert split)
n (new)
p (previous)
o (only)
q (quit)
b (move to bottom)
r (rotate)
x (swap)
+ (bigger)
- (smaller)
_ (maximize)
> (wider)
:buffers (list buffers)
:b (number) (go to buffer number)

Memorize that previous list and you are ready to go.
And don’t worry, the great thing about vim is that you’ll never reach the “expert” level, not even after years of use and continuous  learning.

Post tags: