2009/12/12

My .vimrc

set number
set hls
set ic
set ai
set enc=utf8
set incsearch
set shiftwidth=3
set nobackup
set hlsearch        " highlight searches
set ignorecase      " ignore case when searching 
set title           " show title in console title bar
set ruler

set modeline
"set tabstop=3 " length of each tab


if has("autocmd")
    " Restore cursor position
    au BufReadPost * if line("'\"") > 0|if line("'\"") <= line("$")|exe("norm '\"")|else|exe "norm $"|endif|endif

    " Filetypes (au = autocmd)
    au FileType helpfile set nonumber      " no line numbers when viewing help
    au FileType helpfile nnoremap     " Enter selects subject
    au FileType helpfile nnoremap     " Backspace to go back
    
    " When using mutt, text width=72
    au FileType mail,tex set textwidth=72
    au FileType cpp,c,java,sh,pl,php,asp  set autoindent
    au FileType cpp,c,java,sh,pl,php,asp  set smartindent
    au FileType cpp,c,java,sh,pl,php,asp  set cindent
    "au BufRead mutt*[0-9] set tw=72
    
    " Automatically chmod +x Shell and Perl scripts
    "au BufWritePost   *.sh             !chmod +x %
    "au BufWritePost   *.pl             !chmod +x %

    " File formats
    au BufNewFile,BufRead  *.pls    set syntax=dosini
    au BufNewFile,BufRead  modprobe.conf    set syntax=modconf
endif

syntax on

參考資料:
http://phuzz.org/vimrc.html

大家來學 Vim
http://edt1023.sayya.org/vim/node1.html

2 則留言: