Saturday, December 6, 2008

My VIM Settings

After doing some trials and errors, I found this setting match my needs to write text documentations.
For linux, I often create a documentation for myself to review settings, learn, and practice.

This is the content of my .vimrc


:syntax enable
:syntax on
:set cmdheight=2
:set tabstop=4
:set shiftwidth=4
:set noautoindent
:set nohlsearch
:filetype off

set ruler

source /usr/share/vim/vim71/mswin.vim
behave mswin

map <S-F7> :0,$d
map <S-F8> :set autoindent smartindent shiftwidth=4
map <S-F9> :syntax on

highlight Normal guibg=grey90
highlight Cursor guibg=Green guifg=NONE
highlight lCursor guibg=Cyan guifg=NONE
highlight NonText guibg=grey80
highlight Constant gui=NONE guibg=grey95
highlight Special gui=NONE guibg=grey95

set nobackup
set nowritebackup

function L1()
execute "normal I-----------------------------------------------------------------------\o"
endfunction

function L2()
execute "normal I=======================================================================\o"
endfunction

function L3()
execute "normal I#######################################################################\o"
endfunction

function L8()
execute "normal I***********************************************************************\o"
endfunction

function Clear()
execute ":0,$d"
endfunction




:filetype off
Because when I create text documentations, sometimes I just copy-paste some text such as command-line I used in doing something, including some '#' marks in the beginning of the line. Then VIM will automatically add # for the next lines. That behavior is often not what I expected.
Maybe that's good for programming language to have a text editor that automatically guess your needs. But not for text documentations.
For me, it's something I hate when create text documentations.
Do you have any idea to share? I just do not want the VIM to insert '#' automatically.

source /usr/share/vim/vim71/mswin.vim
I used this option because I also often use Windows and get used to with Windows text editor's behaviors. If you used my VIM's settings, you should adjust the version to match your VIM version.