Tuesday, October 16, 2007

my .vimrc

" LEO's customization

" version 4.0

set nocompatible

" Broadcom coding style
set shiftwidth=3
set tabstop=3
set expandtab

" Nice search
set incsearch
set ignorecase
set smartcase

set ai
set backspace=2


"set backupdir=~/.backup
"set nobackup

" My shortcut key mapping
map gs :%s/

map <c-j> <c-w>j
map <c-k> <c-w>k
map <c-h> <c-w>h
map <c-l> <c-w>l

map <f2> @q
map <f3> @a
map <f10> :set paste<cr>
map <f11> <c-w>-
map <f12> <c-w>+

map :Q :qa!

" For nicer scroll, who knows
set showcmd
set sm
set ss=1
set siso=9
set so=3

" highlight search result
set hls

" syntax highlight
syntax on
colorscheme darkblue

"copy and paste betweeen different vim sessions
nmap <c-y> :!echo ""> ~/.vi_tmp<cr><cr>:w! ~/.vi_tmp<cr>
vmap <c-y> :w! ~/.vi_tmp<cr>
nmap <c-p> :r ~/.vi_tmp<cr>
vmap <c-p> c<esc>:r ~/.vi_tmp<cr>
nmap :Q :qa

"expand the directory with pwd of file under editing
nmap ,e :e <c-r>=expand("%:p:h") . "/" <cr>
nmap ,n :new <c-r>=expand("%:p:h") . "/" <cr>

" Remember the last edit position
set viminfo='10,\"100,:20,%,n~/.viminfo
au BufReadPost * if line("'\"") > 0|if line("'\"") <= line("$")|exe("norm '\"")|else|exe "norm $"|endif|endif

" Command abbreviation for spell checking
cab aspe :w<cr>:!aspell -e -x -c %<cr>:e<cr><cr>

highlight RedundantSpaces term=standout ctermbg=red guibg=red
match RedundantSpaces /\s\+$\| \+\ze\t/

set ruler
set autoindent
set smartindent

"set spell

"set statusline=%F%m%r%h%w\ [FORMAT=%{&ff}]\ [TYPE=%Y]\ [ASCII=\%03.3b]\ [HEX=\%02.2B]\ [POS=%04l,%04v][%p%%]\ [LEN=%L]
"set statusline=%F%m%r%h%w\ [[TYPE=%Y]\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ [POS=%04l,%04v][%p%%]\ [LEN=%L]
"set laststatus=2


let perl_extended_vars=1
filetype plugin on " load filetype plugins

set visualbell t_vb=
let loaded_matchparen=1