Wednesday, January 30, 2008

How to customize my VIM

To have highlight in programming, follow this

1. Create a .vimrc in your $HOME directory:

vim ~/.vimrc

2. Put all the statements in it:

syntax on
set number
set wrapmargin=1
...

Now syntax highlighter and numbering should be on.


"
syntax on
set number
set wrapmargin=1
set autoindent
set smartindent
set nocompatible
set showmatch
set ruler
set nohls
set showcmd
set showmode
set cindent
"

Above is how my .vimrc looks like.

set nocompatible

This setting prevents vim from emulating the original vi's bugs and limitations.

set autoindent
set smartindent

The first setting tells vim to use "autoindent" (that is, use the current line's indent level to set the indent level of new lines). The second makes vim attempt to intelligently guess the indent level of any new line based on the previous line, assuming the source file is in a C-like language. Combined, they are very useful in writing well-formatted source code.

set showmatch

This setting will cause the cursor to very briefly jump to a brace/parenthese/bracket's "match" whenever you type a closing or opening brace/parenthese/bracket. I've had almost no mismatched-punctuation errors since I started using this setting.

set ruler

This setting ensures that each window contains a statusline that displays the current cursor position.

set nohls

By default, search matches are highlighted. I find this annoying most of the time. This option turns off search highlighting. You can always turn it back on with :set hls.





More info can be obtained from Google : )

and

http://vimdoc.sourceforge.net/htmldoc/usr_toc.html

http://www.vi-improved.org/vimrc.php

http://vim.sourceforge.net/index.php

No comments: