Login or register    

Vim Tips and Tricks

As I learn more about vim, I plan to document the tips and tricks I learn here.

how to set tab to 4 spaces in vim

Add the following into your .vimrc file:

set tabstop=4
set shiftwidth=4
set expandtab

how to highlight spelling errors

set spell spelllang=en_us

vimdiff or hg merge

This is a list of some common commands when using vimdiff:

ctrl w (twice)
switch windows

do
diff obtain, take the other window's differences. Pull the change.

dp
diff put, give the other window our differences. Push the change.

[c
move focus to previous difference.

]c
move focus to next difference.

:diffupdate
diff update

:diffget <window number>
get changes from specified window number and place them into current window.

:diffput <window number>
put changes from current window into specified window number.

zo
open folded text

zc
close folded text

Comments

bgolemon 02:05 PM 03-27-2011

You should take a look at my vimrc here. It solves some common annoyances without changing the way vim works much.

Leave a comment

Please login or register to leave a comment!