runtime! debian.vim "设置编码 set encoding=utf-8 set fencs=utf-8,ucs-bom,shift-jis,gb18030,gbk,gb2312,cp936 set fileencodings=utf-8,ucs-bom,chinese"语言设置 set langmenu=zh_CN.UTF-8" command WQ wq command Wq wq command W w command Q q mapi( ea) map oprintf("bug!here is a bug!!!! "); map :wq map oprintf("------------------------------------------------------------ "); "设置语法高亮 syntax enable "syntax on"设置配色方案 "colorscheme torte"可以在buffer的任何地方使用鼠标 set mouse=a set selection=exclusive set selectmode=mouse,key"高亮显示匹配的括号 set showmatch"去掉vi一致性 set nocompatible"设置缩进 set tabstop=4 set softtabstop=4 set shiftwidth=4 set autoindent set cindent if &term=="xterm"set t_Co=8set t_Sb=^[[4%dmset t_Sf=^[[3%dm endif"打开文件类型自动检测功能 filetype on"设置taglist let Tlist_Show_One_File=0 "显示多个文件的tags let Tlist_File_Fold_Auto_Close=1 "非当前文件,函数列表折叠隐藏 let Tlist_Exit_OnlyWindow=1 "在taglist是最后一个窗口时退出vim let Tlist_Use_SingleClick=1 "单击时跳转 let Tlist_GainFocus_On_ToggleOpen=1 "打开taglist时获得输入焦点 let Tlist_Process_File_Always=1 "不管taglist窗口是否打开,始终解析文件中的tag" minibufexplorer let g:miniBufExplMapWindowNavVim=1 let g:miniBufExplMapWindowNavArrows=1 let g:miniBufExplMapCTabSwitchBufs=1 let g:miniBufExplModSelTarget=1 let g:miniBufExplMoreThanOne=0" "设置WinManager插件 let g:winManagerWindowLayout='FileExplorer|TagList' nmap wm :WMToggle map :WMToggle "将F9绑定至WinManager,即打开WimManager"设置CSCOPE set cscopequickfix=s-,c-,d-,i-,t-,e- "设定是否使用quickfix窗口显示cscope结果"设置Grep插件 nnoremap :Grep "设置自动补全 "filetype plugin indent on "打开文件类型检测 set completeopt=longest,menu "关掉智能补全时的预览窗口"启动vim时如果存在tags则自动加载 if exists("tags")set tags=./tags endif"设置按F12就更新tags的方法 map :call Do_CsTag() nmap s :cs find s =expand(" ") :copen nmap g :cs find g =expand(" ") nmap c :cs find c =expand(" ") :copen nmap t :cs find t =expand(" ") :copen nmap e :cs find e =expand(" ") :copen nmap f :cs find f =expand(" ") :copen nmap i :cs find i ^ =expand(" ") $ :copen nmap d :cs find d =expand(" ") :copen function Do_CsTag()let dir = getcwd()if filereadable("tags")if(g:iswindows==1)let tagsdeleted=delete(dir."\"."tags")elselet tagsdeleted=delete("./"."tags")endifif(tagsdeleted!=0)echohl WarningMsg | echo "Fail to do tags! I cannot delete the tags" | echohl Nonereturnendifendifif has("cscope")silent! execute "cs kill -1"endifif filereadable("cscope.files")if(g:iswindows==1)let csfilesdeleted=delete(dir."\"."cscope.files")elselet csfilesdeleted=delete("./"."cscope.files")endifif(csfilesdeleted!=0)echohl WarningMsg | echo "Fail to do cscope! I cannot delete the cscope.files" | echohl Nonereturnendifendifif filereadable("cscope.out")if(g:iswindows==1)let csoutdeleted=delete(dir."\"."cscope.out")elselet csoutdeleted=delete("./"."cscope.out")endifif(csoutdeleted!=0)echohl WarningMsg | echo "Fail to do cscope! I cannot delete the cscope.out" | echohl Nonereturnendifendifif(executable('ctags'))"silent! execute "!ctags -R --c-types=+p --fields=+S *" silent! execute "!ctags -R --c++-kinds=+p --fields=+iaS --extra=+q ."endifif(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"elsesilent! execute "!dir /s/b *.c,*.cpp,*.h,*.java,*.cs >> cscope.files"endifsilent! execute "!cscope -b"execute "normal :"if filereadable("cscope.out")execute "cs add cscope.out"endifendif endfunction"设置默认shell set shell=bash"设置VIM记录的历史数 set history=400"设置当文件被外部改变的时侯自动读入文件 if exists("&autoread")set autoread endif"设置ambiwidth set ambiwidth=double"设置文件类型 set ffs=unix,dos,mac"设置增量搜索模式 set incsearch"设置静音模式 set noerrorbells set novisualbell set t_vb="不要备份文件 set nobackup set nowb set nu"让状态栏一致保留在命令行上方 function! CurDir()let curdir = substitute(getcwd(), $HOME, "~", "g")return curdir endfunction set laststatus=2 set statusline=[%n] %f%m%r%h | pwd: %{CurDir()} | go!go!go!baochunzhiexecute pathogen#infect() syntax on filetype plugin indent on "打开文件类型检测"Grep插件 nnoremap :Grep