|
发表于 2004-8-13 17:15:46
|
显示全部楼层
这是我现在用的vimrc
- set nocompatible
- "set fe=prc
- set bs=2 " allow backspacing ove r everything in insert mode
- set ai " always set autoindent ing on
- set backup " keep a backup file
- set viminfo='20,"50 " read/write a .viminfo file, don't store more
- " than 50 lines of regi sters
- set history=50 " keep 50 lines of comm and line history
- set ruler " show the cursor posit ion all the time
- map Q gq
- vnoremap p <Esc>:let current_reg = @"<CR>gvdi<C -R>=current_reg<CR><Esc>
- if &t_Co > 2 || has("gui_running")
- syntax on
- set hlsearch
- endif
- if has("autocmd")
- autocmd BufRead *.txt set tw=78
- augroup cprog
- au!
- autocmd FileType * set formatoptions=tcq l nocindent comments&
- autocmd FileType c,cpp set formatoptions=cro ql cindent comments=sr:/*,mb:*,el:*/,://
- augroup END
- augroup gzip
- au!
- autocmd BufReadPre,FileReadPre *.gz,*. bz2 set bin
- autocmd BufReadPost,FileReadPost *.gz ca ll GZIP_read("gunzip")
- autocmd BufReadPost,FileReadPost *.bz2 c all GZIP_read("bunzip2")
- autocmd BufWritePost,FileWritePost *.gz ca ll GZIP_write("gzip")
- autocmd BufWritePost,FileWritePost *.bz2 c all GZIP_write("bzip2")
- autocmd FileAppendPre *.gz ca ll GZIP_appre("gunzip")
- autocmd FileAppendPre *.bz2 c all GZIP_appre("bunzip2")
- autocmd FileAppendPost *.gz ca ll GZIP_write("gzip")
- autocmd FileAppendPost *.bz2 c all GZIP_write("bzip2")
- fun! GZIP_read(cmd)
- let ch_save = &ch
- set ch=3
- let empty = line("'[") == 1 && line("']") = = line("$")
- let tmp = tempname()
- let tmpe = tmp . "." . expand("<afile>:e")
- " write the just read lines to a temp file "'[,']w tmp.gz"
- execute "'[,']w " . tmpe
- " uncompress the temp file "!gunzip tmp.gz"
- execute "!" . a:cmd . " " . tmpe
- " delete the compressed lines
- '[,']d
- " read in the uncompressed lines "'[-1r tmp "
- set nobin
- execute "'[-1r " . tmp
- " if buffer became empty, delete trailing b lank line
- if empty
- normal Gdd''
- endif
- " delete the temp file
- call delete(tmp)
- let &ch = ch_save
- " When uncompressed the whole buffer, do au tocommands
- if empty
- execute ":doautocmd BufReadPost " . expan d("%:r")
- endif
- endfun
- " After writing compressed file: Compress wri tten file with "cmd"
- fun! GZIP_write(cmd)
- if rename(expand("<afile>"), expand("<afile >:r")) == 0
- execute "!" . a:cmd . " <afile>:r"
- endif
- endfun
- fun! GZIP_appre(cmd)
- execute "!" . a:cmd . " <afile>"
- call rename(expand("<afile>:r"), expand("<a file>"))
- endfun
- augroup END
- if 0
- autocmd BufReadPost * if line("'"") && line ("'"") <= line("$") | exe "normal `"" | endif
- endif
- endif " has("autocmd")
复制代码 |
|