if v:lang =~ "utf8$" || v:lang =~ "UTF-8$" set fileencodings=utf-8,latin1 endif if(has("win32") || has("win95") || has("win64") || has("win16")) let g:iswindows=1 else let g:iswindows=0 endif autocmd BufEnter * lcd %:p:h """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" if(g:iswindows==1) set go= "无菜单、工具栏" colorscheme darkblack cd c:\Users\Wu Zhenzhen\Desktop\ set guifont=Courier_New:h11 set gfw=MingLiU:h12 winpos 0 0 set lines=42 columns=168 endif set nocompatible " Use Vim defaults (much better!) set bs=indent,eol,start " allow backspacing over everything in insert mode "set ai " always set autoindenting on "set backup " keep a backup file set viminfo='20,\"50 " read/write a .viminfo file, don't store more " than 50 lines of registers set history=50 " keep 50 lines of command line history set ruler " show the cursor position all the time " Only do this part when compiled with support for autocommands if has("autocmd") augroup redhat " In text files, always limit the width of text to 78 characters autocmd BufRead *.txt set tw=78 " When editing a file, always jump to the last cursor position autocmd BufReadPost * \ if line("'\"") > 0 && line ("'\"") <= line("$") | \ exe "normal! g'\"" | \ endif augroup END endif if has("cscope") && filereadable("/usr/bin/cscope") set csprg=/usr/bin/cscope set csto=0 set cst set nocsverb " add any database in current directory if filereadable("cscope.out") cs add cscope.out " else add database pointed to by environment elseif $CSCOPE_DB != "" cs add $CSCOPE_DB endif set csverb endif " 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 if &term=="xterm" set t_Co=8 set t_Sb=[4%dm set t_Sf=[3%dm endif filetype plugin on filetype indent on set autoindent set smartindent set cindent set nu set tabstop=4 set cursorline set nowrap set hlsearch set shiftwidth=4 set softtabstop=4 au FileType xml setlocal equalprg=xmllint\ --format\ --recover\ -\ 2>/dev/null set incsearch "set backspace=indent,eol,start whichwrap+=<,>,[,] if(g:iswindows==1) if has('mouse') set mouse=a endif au GUIEnter * simalt ~x endif set cscopequickfix=s-,c-,d-,i-,t-,e- map <F12> :call Do_CsTag()<CR> "查找声明 nmap <C-\>s :cs find s <C-R>=expand("<cword>")<CR><CR>:copen<CR> nmap <C-\>g :cs find g <C-R>=expand("<cword>")<CR><CR> nmap <C-\>c :cs find c <C-R>=expand("<cword>")<CR><CR>:copen<CR> nmap <C-\>t :cs find t <C-R>=expand("<cword>")<CR><CR>:copen<CR> nmap <C-\>e :cs find e <C-R>=expand("<cword>")<CR><CR>:copen<CR> nmap <C-\>f :cs find f <C-R>=expand("<cfile>")<CR><CR>:copen<CR> nmap <C-\>i :cs find i ^<C-R>=expand("<cfile>")<CR>$<CR>:copen<CR> nmap <C-\>d :cs find d <C-R>=expand("<cword>")<CR><CR>:copen<CR> function! Do_CsTag() let dir = getcwd() if filereadable("tags") if(g:iswindows==1) let tagsdeleted=delete(dir."\\"."tags") else let tagsdeleted=delete("./"."tags") endif if(tagsdeleted!=0) echohl WarningMsg | echo "Fail to do tags! I cannot delete the tags" | echohl None return endif endif if has("cscope") silent! execute "cs kill -1" endif if filereadable("cscope.files") if(g:iswindows==1) let csfilesdeleted=delete(dir."\\"."cscope.files") else let csfilesdeleted=delete("./"."cscope.files") endif if(csfilesdeleted!=0) echohl WarningMsg | echo "Fail to do cscope! I cannot delete the cscope.files" | echohl None return endif endif if filereadable("cscope.out") if(g:iswindows==1) let csoutdeleted=delete(dir."\\"."cscope.out") else let csoutdeleted=delete("./"."cscope.out") endif if(csoutdeleted!=0) echohl WarningMsg | echo "Fail to do cscope! I cannot delete the cscope.out" | echohl None return endif endif if(executable('ctags')) "silent! execute "!ctags -R --c-types=+p --fields=+S *" "silent! execute "!ctags -R --c++-kinds=+p --fields=+iaS --extra=+q ." silent! execute "!ctags -R " endif if(executable('cscope') && has("cscope") ) if(g:iswindows!=1) silent! execute "!find . -name '*.h' -o -name '*.c' -o -name '*.cpp' -o -name '*.java' -o -name '*.cs' > cscope.files" else silent! execute "!dir /s/b *.c,*.cpp,*.h,*.java,*.cs >> cscope.files" endif silent! execute "!cscope -b" execute "normal :" if filereadable("cscope.out") execute "cs add cscope.out" echohl WarningMsg | echo "Succ to add cscope!" | echohl None endif endif endfunction "map <F3> :silent! Tlist<CR> nmap <silent> tl :Tlist<cr> let Tlist_Ctags_Cmd='ctags' let Tlist_Sort_Type = "name" let Tlist_Use_Right_Window=1 let Tlist_Show_One_File=1 let Tlist_File_Fold_Auto_Close=0 let Tlist_Exit_OnlyWindow=1 let Tlist_Process_File_Always=0 let Tlist_Compact_Format=1 "let Tlist_Auto_Open=1 "let NERDShutUp=1 let mapleader = "," map fg : Dox<cr> let g:DoxygenToolkit_authorName="Wu Zhenzhen" let g:DoxygenToolkit_briefTag_pre = "Create on : ".strftime("%Y-%m-%d %H:%M:%S") let g:DoxygenToolkit_maxFunctionProtoLines = 30 set foldenable set foldmethod=syntax set foldcolumn=0 setlocal foldlevel=1 " set foldclose=all let php_folding = 1 nnoremap <space> @=((foldclosed(line('.')) < 0) ? 'zc' : 'zo')<CR> "let g:miniBufExplMapWindowNavVim = 1 "let g:miniBufExplMapWindowNavArrows = 1 "let g:miniBufExplMapCTabSwitchBufs = 1 "let g:miniBufExplModSelTarget = 1 "let g:miniBufExplMoreThanOne= 0 " MiniBufExpl Colors "hi MBEVisibleActive guifg=#A6DB29 guibg=fg "hi MBEVisibleChangedActive guifg=#F1266F guibg=fg "hi MBEVisibleChanged guifg=#F1266F guibg=fg "hi MBEVisibleNormal guifg=#5DC2D6 guibg=fg "hi MBEChanged guifg=#CD5907 guibg=fg "hi MBENormal guifg=#808080 guibg=fg let g:bufExplorerSortBy='fullpath' let g:bufExplorerSplitOutPathName=0 let g:bufExplorerUseCurrentWindow=1 let g:bufExplorerReverseSort=1 let g:bufExplorerShowNoName=1 let g:bufExplorerShowRelativePath=0 noremap <silent> <F11> :BufExplorerHorizontalSplit<CR> "noremap <silent> <F11> :BufExplorerVerticalSplit<CR> "au FileType java VimEnter * NERDTree autocmd VimEnter *.java,*.c,*.c++,*.cpp NERDTree let NERDTreeShowBookmarks=1 let NERDTreeIgnore=['\.o$', '\~$', '\.a$', '\.bak$', '\.d$', '\.class$', '.svn$', 'target$'] let NERDTreeDirArrows=0 let NERDTreeChDirMode=2 let NERDChristmasTree=1 let NERDTreeCaseSensitiveSort=1 let NERDTreeShowHidden=0 let NERDTreeWinSize=50 nmap <silent> nt :NERDTreeToggle<cr> nmap <silent> qf :cclose<CR> "Hide some files "let g:explHideFiles='^\.,.*\.class$,.*\.swp$,.*\.swo$,\.DS_Store$' "nmap <silent> <leader>tt :NERDTreeToggle<cr> "let g:NERDTree_title="[NERD Tree]" "let g:winManagerWindowLayout = "TagList|NERDTree" "function! NERDTree_Start() " exec 'NERDTree' "endfunction "function! NERDTree_IsValid() " return 1 "endfunction "nmap <silent> <F8> :if IsWinManagerVisible() <BAR> WMToggle<CR> <BAR> else <BAR> WMToggle<CR>:q<CR> endif <CR><CR> "nmap <silent> wm :WMToggle<cr> "let g:winManagerWindowLayout = "BufExplorer,FileExplorer|TagList" "let g:winManagerWindowLayout='FileExplorer|TagList' "let g:winManagerWidth = 30 "let g:bufExplorerMaxHeight=60 "nmap <silent> wm :WMToggle<cr> "nmap <silent> wm :WMToggle<cr>:q<cr> "nmap wm :WMToggle<cr> "map <silent> <F2> :WMToggle<cr> "nnoremap <silent> <F3> :Grep<CR> nnoremap <silent> <F3> :Rgrep<CR> filetype plugin indent on set completeopt=longest,menu autocmd FileType java set omnifunc=javacomplete#Complete au FileType java setlocal completefunc=javacomplete#CompleteParamsInfo setlocal omnifunc=javacomplete#Complete setlocal completefunc=javacomplete#CompleteParamsInfo inoremap <buffer> <A-/> <C-X><C-N><C-N> inoremap <buffer> <C-Space> <C-X><C-O><C-N> "autocmd Filetype java inoremap <buffer> . .<C-X><C-O><C-P> "autocmd FileType java inoremap <expr> <CR> pumvisible()?"\<C-Y>":"<CR>" "inoremap <expr> <CR> pumvisible()?"\<C-Y>":"\<CR>" "inoremap <expr> <C-J> pumvisible()?"\<PageDown>\<C-N>\<C-P>":"\<C-X><C-O>" "inoremap <expr> <C-K> pumvisible()?"\<PageUp>\<C-P>\<C-N>":"\<C-K>" "inoremap <expr> <C-U> pumvisible()?"\<C-E>":"\<C-U>" "func! Compile_Java_Code() " exec "w" " if &filetype == "java" " exec "!javac -encoding utf-8 %" " endif "endfunc "func! Run_Java_Code() " if &filetype == "java" " exec "!java -classpath %:h; %:t:r" " endif "endfunc "map <F5> :call Compile_Java_Code()<CR> "map <F6> :call Run_Java_Code()<CR> """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" let g:vimrc_author='Wu Zhenzhen' let g:vimrc_email='[email protected]' nmap <F4> :AuthorInfoDetect<cr><esc><esc> "au FileType java,c,cpp,c++ AuthorInfoDetect<cr><esc><esc> "au FileType java,c,cpp,c++ AuthorInfoDetect