Some vim tips
svn diff the current windows file
Put this in your vimrc:
map zs :!svn diff % > /tmp/vimsvndiff<CR><CR>
\ :new<CR>:r /tmp/vimsvndiff<CR>
\ :set ft=diff<CR>
Say you’re editing a checked out file and what to see what changes you’ve done without leaving your VIM session? Just type zs when in normal mode. This will open the diff in a new split window.
Apply tabs to a block of text
I found myself doing this often. Visual selecting some text and then applying a regex to prepend some spaces (or a tab) to each line
Put this in your vimrc:
map <C-i> :s/^/ / :nohlsearch
map <C-p> :s/^ // :nohlsearch
So Control-i will insert 4 spaces for all lines of the selected text. Control-p will remove 4 spaces. Very handy!
January 1st, 2009 at 2:06 am
Hi Rohan,
For (un)indenting code in a visual selection in Vim, double arrows can be used:
>> - indents code
January 4th, 2009 at 6:41 am
Yeah, I came to know about the > and < commands a bit too late!