我的.vimrc备份


版权声明:可以任意转载,转载时请务必以超链接形式标明文章原始出处和作者信息

” An example for a vimrc file.

” Maintainer: Bram Moolenaar <
Bram@vim.org>
” Last change: 2002 May 28

” To use it, copy it to
” for Unix and OS/2: ~/.vimrc
” for Amiga: s:.vimrc
” for MS-DOS and Win32: $VIM\_vimrc
” for OpenVMS: sys$login:.vimrc

” When started as “evim”, evim.vim will already have done these settings.
if v:progname =~? “evim”
finish
endif

” Use Vim settings, rather then Vi settings (much better!).
” This must be first, because it changes other options as a side effect.
set nocompatible

” allow backspacing over everything in insert mode
set backspace=indent,eol,start

“set autoindent ” always set autoindenting on
if has(“vms”)
set nobackup ” do not keep a backup file, use versions instead
else
set backup ” keep a backup file
endif
set history=50 ” keep 50 lines of command line history
set ruler ” show the cursor position all the time
set showcmd ” display incomplete commands
set incsearch ” do incremental searching

” For Win32 GUI: remove ‘t’ flag from ‘guioptions’: no tearoff menu entries
” let &guioptions = substitute(&guioptions, “t”, “”, “g”)

” Don’t use Ex mode, use Q for formatting
map Q gq

“###################################################################
“@author – huangwei
“@created on – 2005-10-20
“@last modified – 10:16 2005-10-21
“——————————————————————-
” F2 – write file without confirmation
” F3 – call file explorer Ex
” F4 – show Taglist
” F5 – automatically insert current time to current location
” F8 – automatically complete keywords
” F12 – switch between windows
“——————————————————————-
” for quick save in normal mode
map <silent> <F2> :write<CR>
map <silent> <F3> :Explore<CR>

” switch between windows
map <silent> <F12> <C-W>w

” for quick save in edit mode
imap <F2> <ESC><F2>a

” according to SMTH’s VIM board
nnoremap <silent> <F4> :Tlist<CR>

” let F5 insert current time to current location.
map <F5> i<C-R>=strftime(“%H:%M %Y-%m-%d”)<ESC><ESC>
” map! <F5> <C-R>=strftime(“%H:%M %Y-%m-%d”)<RETURN>

“mouse function support
set mouse=a

” set auto shift width
” set shiftwidth=4

” disable auto backup
set nobackup

” set root directory of DICTIONARY, whose value by default is
” NULL to Linux
” /cygdrive/c to cygwin
” C: to Win32
let g:DIC_ROOT_DIR=”"

” set default ‘dictionary’ path
execute “:set dictionary=”.g:DIC_ROOT_DIR.”/usr/share/dict/words”
” more and more place including such keyword
set iskeyword+=-
” Let F8 made dictionary automatically complete keywords.
map! <F8> <C-X><C-K>

“”"”"”"”"”"”"”"”"”"”"”"”"”"”"”"”"”"”"”"”"”"”"”"”"”*
” autocmd FileType * set comments&
“”"”"”"”"”"”"”"”"”"”"”"”"”"”"”"”"”"”"”"”"”"”"”"”"”C

autocmd FileType c call C()
fun! C()
set cindent
set comments=sr:/*,mb:*,el:*/,://
set commentstring=\ \ //\ %s\ ” <SPACE>
set foldcolumn=3
set expandtab
set tags+=/usr/include/tags
let tmpvar=&dictionary
execute “:set dictionary=”.g:DIC_ROOT_DIR.”/usr/share/dict/C,” . tmpvar
unlet tmpvar
” control-c comments block
vmap <C-C> :s/^/\/\//g<enter>
” control-x uncomments block
vmap <C-X> :s/^\/\///g<enter>
map! =for for(i = 0; i < ; i++){<LEFT><LEFT><LEFT><LEFT><LEFT><LEFT><LEFT>
endfun ” endfun C

“”"”"”"”"”"”"”"”"”"”"”"”"”"”"”"”"”"”"”"”"”"”"”"”"CPP
autocmd FileType cpp call CPP()
fun! CPP()
set cindent
set comments=sr:/*,mb:*,el:*/,://
set commentstring=\ \ //\ %s\ ” <SPACE>
set foldcolumn=3
set expandtab
set tags+=/usr/include/tags
” control-c comments block
vmap <C-C> :s/^/\/\//g<enter>
” control-x uncomments block
vmap <C-X> :s/^\/\///g<enter>
let tmpvar=&dictionary
execute “:set dictionary=”.g:DIC_ROOT_DIR.”/usr/share/dict/CPP,” . tmpvar
unlet tmpvar
endfun ” endfun CPP

“”"”"”"”"”"”"”"”"”"”"”"”"”"”"”"”"”"”"”"”"”"”"”"”"PERL
autocmd FileType sed,awk,perl call PERL()
fun! PERL()
set cindent
set commentstring=\ \ #\ %s\ ” <SPACE>
set foldcolumn=3
” control-c comments block
vmap <C-C> :s/^/#/g<enter>
” control-x uncomments block
vmap <C-X> :s/^#//g<enter>
” append dictionary
let tmpvar=&dictionary
execute “:set dictionary=”.g:DIC_ROOT_DIR.”/usr/share/dict/PERL,” . tmpvar
unlet tmpvar
endfun ” endfun PERL

“”"”"”"”"”"”"”"”"”"”"”"”"”"”"”"”"”"”"”"”"”"”"”"”"HTML
autocmd FileType html call HTML()
fun! HTML()
let tmpvar=&dictionary
execute “:set dictionary=”.g:DIC_ROOT_DIR.”/usr/share/dict/HTML,” . tmpvar
unlet tmpvar
endfun ” endfun HTML
“”"”"”"”"”"”"”"”"”"”"”"”"”"”"”"”"”"”"”"”"”"”"”"”"JAVA
autocmd FileType java call JAVA()
fun! JAVA()
set cindent
set commentstring=\ \ //\ %s\ ” <SPACE>
set foldcolumn=3
set expandtab tags+=${JAVA_HOME}/src/tags
” control-c comments block
vmap <C-C> :s/^/\/\//g<enter>
” control-x uncomments block
vmap <C-X> :s/^\/\///g<enter>
let tmpvar=&dictionary
execute “:set dictionary=”.g:DIC_ROOT_DIR.”/usr/share/dict/JAVA,” . tmpvar
unlet tmpvar
map! =for for(int i = 0; i < ; i++){<LEFT><LEFT><LEFT><LEFT><LEFT><LEFT><LEFT>
map! =psvm public static void main(String [] args){<RETURN>
map! =soutn System.out.println(
map! =sout System.out.print(
map! =try try{<RETURN>}catch(Exception e){<RETURN>System.out.println(e.getMessage());<RETURN>}<ESC>kkko
map! =tryb try{<ESC>:/^[ \t]*$/<RETURN>ddko}catch(Exception e){<RETURN>System.out.println(e.getMessage());<RETURN>}<ESC>k
endfun ” endfun JAVA

“”"”"”"”"”"”"”"”"”"”"”"”"”"”"”"”"”"”"”"”"”"”"”"”"JSP
autocmd FileType jsp call JSP()
fun! PHP()
let tmpvar=&dictionary
execute “:set dictionary=”.g:DIC_ROOT_DIR.”/usr/share/dict/JSP,” . tmpvar
unlet tmpvar
endfun ” endfun JSP

“”"”"”"”"”"”"”"”"”"”"”"”"”"”"”"”"”"”"”"”"”"”"”"”"JS
autocmd FileType js call JS()
fun! JS()
let tmpvar=&dictionary
execute “:set dictionary=”.g:DIC_ROOT_DIR.”/usr/share/dict/JS,” . tmpvar
unlet tmpvar
endfun ” endfun JS

“”"”"”"”"”"”"”"”"”"”"”"”"”"”"”"”"”"”"”"”"”"”"”"”"PHP
autocmd FileType php call PHP()
fun! PHP()
let tmpvar=&dictionary
execute “:set dictionary=”.g:DIC_ROOT_DIR.”/usr/share/dict/PHP,” . tmpvar
unlet tmpvar
endfun ” endfun PHP

“”"”"”"”"”"”"”"”"”"”"”"”"”"”"”"”"”"”"”"”"”"”"”"”"XML
autocmd FileType xml call XML()
fun! XML()
let tmpvar=&dictionary
execute “:set dictionary=”.g:DIC_ROOT_DIR.”/usr/share/dict/XML,” . tmpvar
unlet tmpvar
endfun ” endfun XML
“##################################################################

” This is an alternative that also works in block mode, but the deleted
” text is lost and it only works for putting the current register.
“vnoremap p “_dp

” Switch syntax highlighting on, when the terminal has colors
” Also switch on highlighting the last used search pattern.
if &t_Co > 2 || has(“gui_running”)
syntax on
set hlsearch
endif

” Only do this part when compiled with support for autocommands.
if has(“autocmd”)

” Enable file type detection.
” Use the default filetype settings, so that mail gets ‘tw’ set to 72,
” ‘cindent’ is on in C files, etc.
” Also load indent files, to automatically do language-dependent indenting.
filetype plugin indent on

” For all text files set ‘textwidth’ to 78 characters.
autocmd FileType text setlocal textwidth=78

” When editing a file, always jump to the last known cursor position.
” Don’t do it when the position is invalid or when inside an event handler
” (happens when dropping a file on gvim).
autocmd BufReadPost *
\ if line(“‘\”") > 0 && line(“‘\”") <= line(“$”) |
\ exe “normal g`\”" |
\ endif

endif ” has(“autocmd”)


原创文章,转载请注明: 转载自猪在笑 [ http://www.huangwei.me/blog/ ]
本文链接地址: http://www.huangwei.me/blog/2005/10/24/iouavimrcy-2/


分享家:Addthis中国
您可能还对以下文章感兴趣