网上找了很多资料,终于搭建了自己的 vim “IDE”, 用了一段时间了,感觉还不错 ~
整合的主要功能有:
1、各自目录树、符号列表、搜索窗口切换定义;
2、ctags + cscope支持,而且 各个打开的vim工程独立不干扰,存放到~/.ctags/ 目录下;
3、保存当前vim配置,下次打开vim还是原来的配置,方便使用,而且最关键的是各个vim工程独立,同样保存在~/.ctags/目录下;
4、模糊、全局搜索使用外部ag搜索引擎,速度很快;
5、各种常用必备插件已配置;
6、其它详细部分见vimrc配置吧;
下面贴出来分享下。
git clone https://github.com/guomingyi/vim-warper.git
相关快捷键配置:
# Install ######################################## cp -a .vim ~/.vim cp -a .vimrc ~/.vimrc # Ctags: cd ~/.vim/depends/ unzip ctags-5.8.zip cd ctags-5.8 ./configure make sudo make install # Cscope: 参考Ctags步骤. ##################[快捷键定义]################# # 窗口类: f2 鼠标使能切换 \f2 行号显示切换 f3 tagbarlist \f3 NERDTree f4 Ctrlp,文件模糊搜索,也可按ctrl+p打开,按esc退出 \f4 MRU,文件打开历史记录,可保存 f5 make tags,用于查看代码进入函数跳转,支持多目录加载 \f5 make cscope,ctags的升级,功能更强大,暂不支持多目录加载 f6 Buf exploler,当前文件打开记录缓存 \f6 miniBufExploler,跟上一个类同 \f7 themes switch # 文件跳转: 1 跳转到上一个文件 2 跳转到下一个文件 \1 关闭当前文件 3 quickfix列表搜索文件条状到下一个 4 quickfix跳转到上一个 # 更新插件: \3 更新插件 # 退出: \q 退出当前窗口 \qa 不保存seesion.vim退出全部 \qs 保存session.vim退出全部 F2 同\qs \w :w # ACK搜索相关: \s Ack 搜索,先按下\s,再输入需要搜索的字符,回车 \f AckFile搜索,同上 # ag 搜索 sudo apt-get install silversearcher-ag # Cscope相关: cc 搜索该函数调用的函数 cd 搜索调用该函数的函数 cs 搜索函数 cf 搜索文件 ct 搜索字符串 # 特殊命令: # 有时候vim的历史记录会有混乱,这个时候有两种方式还原: 1> rm -rf ~./ctags/ 2> vim clean
打开后默认界面:
按 F3 切换显示tagbar ,\F3 切换显示nerdtree, F4 弹出ctrlp模糊搜索
按\F4 切换ctrlp-funky,模糊搜索当前文件函数,ctrlp搜索使用外部ag搜索引擎
buffer 浏览器,按F6切换
F5 执行make tags,tags的目录做了重定向,每个新打开的vim工程互不干扰。
make cscope,和ctags类同
ag搜索符号
vimrc 全配置:
1 2 "##################################################################[Plugin manager] 3 " http://www.cnblogs.com/songfy/p/5635757.html 4 set rtp+=~/.vim/bundle/Vundle.vim 5 6 call vundle#begin() 7 8 Plugin 'VundleVim/Vundle.vim' 9 Plugin 'tpope/vim-fugitive' 10 Plugin 'vim-scripts/winmanager' 11 Plugin 'rstacruz/sparkup', {'rtp': 'vim/'} 12 Plugin 'kien/ctrlp.vim' 13 Plugin 'wincent/command-t' 14 Plugin 'scrooloose/nerdtree' 15 Plugin 'majutsushi/tagbar' 16 Plugin 'jiangmiao/auto-pairs' 17 Plugin 'minibufexpl.vim' 18 Plugin 'jlanzarotta/bufexplorer' 19 Plugin 'taglist.vim' 20 Plugin 'scrooloose/nerdcommenter' 21 Plugin 'godlygeek/tabular' 22 Plugin 'plasticboy/vim-markdown' 23 Plugin 'portante/cscope' 24 Plugin 'tomasr/molokai' 25 Plugin 'yegappan/mru' 26 Plugin 'rking/ag.vim' 27 Plugin 'altercation/vim-colors-solarized' 28 Plugin 'tacahiroy/ctrlp-funky' 29 Plugin 'Lokaltog/vim-distinguished' 30 31 "Plugin 'Valloric/YouCompleteMe' "NEED VIM8.0+ & PYTHON3.5+ support. 32 "Plugin 'vim/vim' "vim8.0+ 33 34 call vundle#end() 35 36 filetype plugin indent on 37 "##################################################################[default value set] 38 set modelines=0 39 set backspace=2 "设置更好的删除 40 syntax on "语法高亮 41 "set noswapfile 42 "autocmd InsertLeave * se nocul "用浅色高亮当前行 43 "autocmd InsertEnter * se cul 44 set cul 45 set paste 46 set smartindent "智能对齐 47 set autoindent "自动对齐 48 set confirm "在处理未保存或只读文件的时候,弹出确认框 49 set tabstop=4 "tab键的宽度 50 set softtabstop=4 51 set shiftwidth=4 "统一缩进为4 52 set expandtab "不要用空格替代制表符 53 54 set history=50 "历史纪录数 55 "set nohlsearch 56 set hlsearch 57 set incsearch "搜素高亮,搜索逐渐高亮 58 59 set gdefault "行内替换 60 set encoding=utf-8 61 set fileencodings=utf-8,ucs-bom,shift-jis,gb18030,gbk,gb2312,cp936,utf-16,big5,euc-jp,latin1 "编码设置 62 63 set guifont=Menlo:h16:cANSI "设置字体 64 set langmenu=zn_CN.UTF-8 65 set helplang=cn "语言设置 66 67 set ruler "在编辑过程中,在右下角显示光标位置的状态行 68 set laststatus=1 "总是显示状态行 69 set showcmd "在状态行显示目前所执行的命令,未完成的指令片段也会显示出来 70 set scrolloff=3 "光标移动到buffer的顶部和底部时保持3行的距离 71 "set showmatch "高亮显示对应的括号 72 set matchtime=5 "对应括号高亮时间(单位是十分之一秒) 73 set autowrite "在切换buffer时自动保存当前文件 74 set wildmenu "增强模式中的命令行自动完成操作 75 set linespace=2 "字符间插入的像素行数目 76 set whichwrap=b,s,<,>,[,] "开启normal 或visual模式下的backspace键空格键, 77 "左右方向键,insert或replace模式下的左方向键,右方向键的跳行功能 78 79 filetype plugin indent on "分为三部分命令:file on,file plugin on,file indent on 80 "分别是自动识别文件类型, 用用文件类型脚本,使用缩进定义文件 81 82 set foldenable "允许折叠 83 set cursorline "突出显示当前行 84 set magic "设置魔术?神马东东 85 set ignorecase "搜索忽略大小写 86 "filetype on "打开文件类型检测功能 87 88 set foldmethod=syntax "使用语法高亮定义代码折叠: zc 折叠, zo 展开 89 set foldlevelstart=99 "打开文件是默认不折叠代码 90 91 "set mouse= "鼠标默认值 92 "set number "显示行号 93 94 " 自动切换vim工作目录 95 " set autochdir 96 " :cd 改变vim的当前工作路径 97 " :lcd 改变当前窗口的工作路径 98 " :pwd 查看当前的工作路径 99 100 behave mswin 101 102 if has("autocmd") 103 au BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\"" | endif 104 au InsertEnter * silent execute "!gconftool-2 --type string --set /apps/gnome-terminal/profiles/Default/cursor_shape ibeam" 105 au InsertLeave * silent execute "!gconftool-2 --type string --set /apps/gnome-terminal/profiles/Default/cursor_shape block" 106 au VimLeave * silent execute "!gconftool-2 --type string --set /apps/gnome-terminal/profiles/Default/cursor_shape block" 107 endif 108 "##################################################################[auto exec cmds] 109 "autocmd VimEnter * TagbarToggle "auto start cmd 110 "autocmd VimEnter * WMToggle "auto start cmd 111 "autocmd VimEnter * NERDTree "auto start cmd 112 113 "default themes 114 autocmd VimEnter * call UserFunctionSwitch(6) 115 116 " default show line number 117 autocmd VimEnter * call UserFunctionSwitch(0) 118 119 " default enable mouse 120 autocmd VimEnter * call UserFunctionSwitch(1) 121 122 "Open Nerdtree when start vim with no argument 123 if argc() == 0 && !exists("s:std_in") 124 " autocmd VimEnter * WMToggle 125 endif 126 127 128 autocmd BufNewFile * call UserFunctionSwitch(52) 129 130 "##################################################################[ctags] 131 " Press F5 to update make ctags. 132 " cd ~/.ctags 133 " ctags -R ${source_path} 134 "silent !~/.vim/shell/make-ctags.sh 135 let g:pwd = getcwd() 136 let g:Newpwd = getcwd() 137 "let g:Newpwd = substitute(g:pwd, $HOME, "", "") 138 let g:Newpwd = "~/.ctags/" . substitute(g:Newpwd, "/", "_", "g") 139 140 let settag = "set tags=" . g:Newpwd . "/tags" 141 "echo settag 142 exec settag 143 144 let g:argc = argc() 145 let g:argv = argv(0) 146 "echo "argv:" g:argv "argc:" g:argc 147 148 if (expand(g:argv) == expand("clean")) 149 let g:clean = 1 150 echo "clean all session.vim.." 151 silent :!~/.vim/shell/del.sh 152 endif 153 154 "##################################################################[key map] 155 nmap 1 : bp <cr> 156 nmap 2 : bn <cr> 157 nmap <Leader>1 : bd <cr> 158 nmap <Leader>3 : PluginInstall <cr> 159 160 nmap 3 : cn <cr> 161 nmap 4 : cp <cr> 162 163 nmap 5 <C-]> 164 165 nmap 6 <C-o> 166 167 nmap 7 <C-i> 168 169 "行号切换 170 map <silent> <F2> : call UserFunctionSwitch(0) <CR> 171 "鼠标切换 172 nmap <silent> <Leader><F2> : call UserFunctionSwitch(1) <CR> 173 174 "neadtree 175 nmap <silent> <Leader><F3> : call UserFunctionSwitch(2) <CR> 176 "tagbarlist 177 nmap <silent> <F3> : call UserFunctionSwitch(3) <CR> 178 179 "mru, file open history record 180 " nmap181 "file search 182 nmap <silent> <F4> : exec "CtrlP ." <CR> 183 nmap <silent> <Leader><F4> : exec "CtrlPFunky" <CR> 184 nmap fu : execute 'CtrlPFunky ' . expand('') 185 186 "make source tags 187 nmap <silent> <F5> : call UserFunctionSwitch(5) <CR> 188 nmap <silent> <Leader><F5> : call UserFunctionSwitch(51) <CR> 189 190 "miniBuf 191 nmap <silent> <Leader><F6> : call UserFunctionSwitch(70) <CR> 192 "buf exploler 193 nmap <silent> <F6> : call UserFunctionSwitch(7) <CR> 194 195 "quickfix 196 nmap <silent> <F7> : call UserFunctionSwitch(8) <CR> 197 "nmap : call UserFunctionSwitch(4) 8 : call UserFunctionSwitch(80) 198 "nmap9 : call UserFunctionSwitch(81) 199 "themes switch 200 nmap <silent> <Leader><F7> : call UserFunctionSwitch(6) <CR> 201 202 nmap <silent> <F8> : call UserFunctionSwitch(50) <CR> 203 204 "ack search file & symbols 205 nmap <Leader>s : Ack <Space> 206 nmap <Leader>f : AckFile <Space> 207 nmap <Leader>q : q <CR> 208 nmap <Leader>qa : qall <CR> 209 nmap :ag : Ag -i <Space> 210 nmap :af : AgFile <Space> 211 212 " quit all & save session.vim. 213 nmap <F12> : call UserFunctionSwitch(30) <CR> 214 nmap <Leader>qs : call UserFunctionSwitch(30) <cr> 215 nmap <Leader>wq : wq <CR> 216 nmap <Leader>w : w <CR> 217 nmap <Leader>rn : %s/\r//g <CR> "替换^M 218 nmap <Leader>rs : call LeaveHandler() <Space> 219 220 " cscope 221 nmap cc : cscope find c <Space> 222 nmap cd : cscope find d <Space> 223 nmap cf : cscope find f <Space> 224 nmap cg : cscope find g <Space> 225 nmap cs : cscope find s <Space> 226 nmap ct : cscope find t <Space> 227 "##################################################################[function] 228 let g:userFuncSwitch = 1 229 let g:line_number_show = 0 230 let g:mouse_enable = 0 231 let g:window_flag = 1 232 let g:MRU_flag = 0 233 let g:themes_flag = 1 234 let g:ctags = "" 235 236 let g:quickfix = 0 237 238 function! UserFunctionSwitch(cmd) 239 let g:userFuncSwitch = a:cmd 240 exec ":syntax on" 241 242 if a:cmd == 0 243 if g:line_number_show == 0 244 exec 'set nu' 245 let g:line_number_show = 1 246 echo 'Show line number!' 247 else 248 exec 'set nonu' 249 let g:line_number_show = 0 250 endif 251 return 252 endif 253 254 if a:cmd == 1 255 if g:mouse_enable == 0 256 let g:mouse_enable = 1 257 exec 'set mouse=n' 258 echo 'enable mouse' 259 else 260 let g:mouse_enable = 0 261 exec 'set mouse=' 262 echo 'disable mouse' 263 endif 264 return 265 endif 266 267 if a:cmd == 2 268 exec 'WMToggle' 269 return 270 endif 271 272 if a:cmd == 3 273 exec 'TagbarToggle' 274 return 275 endif 276 277 if a:cmd == 4 278 if g:MRU_flag == 0 279 let g:MRU_flag = 1 280 exec 'MRU' 281 else 282 let g:MRU_flag = 0 283 exec 'MRU' 284 exec 'q' 285 endif 286 return 287 endif 288 289 if a:cmd == 5 290 echo "Start make tag.." 291 let g:time1 = localtime() 292 let g:ctags = system("~/.vim/shell/make-ctags.sh " . shellescape(expand('%:h'))) 293 let g:ctag_execcmd = "set tags+=" . g:ctags 294 exec g:ctag_execcmd 295 let g:time2 = localtime() 296 echo g:ctag_execcmd "escape time:" (g:time2 - g:time1)"s" 297 return 298 endif 299 300 " 一键更新ctags & cscope.. 301 if a:cmd == 50 302 " exec g:ctag_execcmd 303 " cs kill -1 304 " exec g:cscope_cmd 305 return 306 endif 307 308 if a:cmd == 51 309 echo "Start make cscope.." 310 let t1 = localtime() 311 let db = system("~/.vim/shell/cscope.sh " . shellescape(expand('%:p'))) 312 let path = strpart(db, 0, match(db, "cscope.out")) " 必须这样截取,否则多余的结束符^@会导致cs add 异常. 313 let g:cscope_cmd = "cs add " . path . "cscope.out" 314 echo g:cscope_cmd 315 cs kill -1 316 exec g:cscope_cmd 317 let t2 = localtime() 318 echo "escape time:" (t2 - t1)"s" 319 return 320 endif 321 322 " 监听执行命令 323 if a:cmd == 52 324 " let cwd = getcwd() 325 " echo "cwd:" cwd 326 return 327 endif 328 329 330 if a:cmd == 6 331 332 if g:themes_flag == 0 333 let g:themes_flag = 1 334 exec "colorscheme solarized" 335 let g:molokai_original = 0 336 let g:rehash256 = 0 337 exec "set background=dark" 338 exec "set t_Co=32" 339 return 340 endif 341 if g:themes_flag == 1 342 let g:themes_flag = 2 343 exec "colorscheme molokai" 344 let g:molokai_original = 1 345 let g:rehash256 = 1 346 exec "set background=dark" 347 exec "set t_Co=256" 348 return 349 endif 350 351 if g:themes_flag == 2 352 let g:themes_flag = 3 353 let g:molokai_original = 0 354 let g:rehash256 = 0 355 exec "colorscheme default" 356 exec "set background=light" 357 exec "set t_Co=128" 358 return 359 endif 360 361 if g:themes_flag == 3 362 let g:themes_flag = 1 363 364 exec "set background=dark" 365 exec "set t_Co=256" 366 return 367 endif 368 return 369 endif 370 371 372 if a:cmd == 70 373 exec 'TMiniBufExplorer' 374 return 375 endi 376 377 if a:cmd == 7 378 exec 'ToggleBufExplorer' 379 return 380 endif 381 382 if a:cmd == 8 383 if g:quickfix == 0 384 let g:quickfix = 1 385 exec "cclose" 386 else 387 let g:quickfix = 0 388 exec "copen" 389 endif 390 return 391 endif 392 393 if a:cmd == 80 394 if g:quickfix == 1 395 exec "bn" 396 else 397 exec "cn" 398 endif 399 return 400 endif 401 402 if a:cmd == 81 403 if g:quickfix == 1 404 exec "bp" 405 else 406 exec "cp" 407 endif 408 return 409 endif 410 411 if a:cmd == 20 412 "call MyTabLine() 413 "echo 'tab:' tab 414 return 415 endif 416 417 if a:cmd == 30 418 let g:quit_save = 1 419 exec "qall" 420 return 421 endif 422 423 endfunction 424 425 "##################################################################[TlistToggle,NERDTree] 426 let NERDTreeQuitOnOpen=1 "打开文件时关闭树 427 let NERDTreeShowBookmarks=1 "显示书签 428 let Tlist_Show_One_File = 1 " 不同时显示多个文件的 tag ,只显示当前文件的 429 let Tlist_Exit_OnlyWindow = 1 " 如果 taglist 窗口是最后一个窗口,则退出 vim 430 let Tlist_Use_Right_Window = 1 431 let Tlist_Auto_Open = 0 432 "###################################################################[cscope] 433 " http://blog.csdn.net/citongke1/article/details/8497244 434 435 " 安装: 436 " sudo apt-get install cscope 437 438 " 创建索引: 439 " cscope -Rbq 440 " 把需要创建索引的文件类型输入到这个文件 441 " find . -type f > cscope.files 442 443 " 添加到vim: 444 " :cs add ./cscope.out 445 446 " 查找函数func: 447 " :cs find s func 448 449 " vim支持8种cscope的查询功能,如下: 450 " s: 查找C语言符号,即查找函数名、宏、枚举值等出现的地方(包括头文件) 451 " g: 查找函数、宏、枚举等定义的位置,类似ctags所提供的功能(比如有可能只在头文件处) 452 " d: 查找本函数调用的函数 453 " c: 查找调用本函数的函数 454 " t: 查找指定的字符串 455 " e: 查找egrep模式,相当于egrep功能,但查找速度快多了 456 " f: 查找并打开文件,类似vim的find功能 457 " i: 查找包含本文件的文件 458 " 其他功能可输入:help cscope查看 459 460 if has("cscope") 461 " set csprg=/usr/bin/cscope 462 set csprg=cscope 463 set csto=1 464 set cst 465 set nocsverb 466 " add any database in current directory 467 " if filereadable("cscope.out") 468 " cs add cscope.out 469 " else add database pointed to by environment 470 " elseif $CSCOPE_DB != "" 471 " cs add $CSCOPE_DB 472 " endif 473 set csverb 474 endif 475 476 "##################################################################[Ctrlp] 477 set rtp+=~/.vim/bundle/ctrlp.vim 478 :helptags ~/.vim/bundle/ctrlp.vim/doc 479 let g:ctrlp_map = '' 480 let g:ctrlp_cmd = 'CtrlP' 481 let g:ctrlp_working_path_mode = 'cra' 482 483 let g:ctrlp_custom_ignore = { 484 \ 'dir': '\v[\/]\.(git|hg|svn|rvm|out|gen)$', 485 \ 'file': '\v\.(exe|so|dll|zip|tar|tar.gz|pyc|a|img|apk|bak|ko|deb|~|swp|tmp|html|jpg|png|bmp|ogg|log|jar|o)$', 486 \ } 487 488 set wildignore+=*/tmp/*,*.so,*.swp,*.zip,*.exe,*.tar,*.deb,*~,*.bak,*.ko,*.bin,*.img,*.apk,*.jar 489 490 let g:ctrlp_regexp = 1 491 492 let g:ctrlp_cache_dir = '~/.cache/ctrlp' 493 let g:ctrlp_show_hidden = 0 494 495 " sudo apt-get install silversearcher-ag 496 " when use ag ,add custom ignore to : ~/.agignore 497 if executable('ag') 498 let g:ctrlp_use_caching = 1 499 set grepprg=ag\ --nogroup\ --nocolor 500 let g:ctrlp_user_command = 'ag %s -l --nocolor --hidden -g ""' 501 else 502 let g:ctrlp_use_caching = 1 503 let g:ctrlp_user_command = ['.git', 'cd %s && git ls-files . -co --exclude-standard', 'find %s -type f'] 504 let g:ctrlp_prompt_mappings = { 505 'AcceptSelection("e")': ['' , '' , '<2-LeftMouse>'], 506 } 507 endif 508 509 " echo "g:ctrlp_user_command :" g:ctrlp_user_command 510 511 let g:ctrlp_clear_cache_on_exit = 0 512 let g:ctrlp_max_depth = 100 513 let g:ctrlp_max_files = 5000000 514 515 " ctrlp-funky 516 let g:ctrlp_funky_syntax_highlight = 1 517 "##################################################################[winManager] 518 let g:NERDTree_title="[NERDTree]" 519 let g:winManagerWindowLayout='NERDTree' 520 521 function! NERDTree_Start() 522 exec 'NERDTree' 523 endfunction 524 525 function! NERDTree_IsValid() 526 return 1 527 endfunction 528 529 " NOTIC!!! modefiy WinManager.vim to fixed open empty file bug: 530 "function!ToggleWindowsManager() 531 " if IsWinManagerVisible() 532 " call s:CloseWindowsManager() 533 " else 534 " call s:StartWindowsManager() 535 " exe 'q' " ADD THIS LINE! 536 " end 537 "endfunction 538 539 "##################################################################[MiniBufExplorer] 540 let g:default_open_minibufexplorer = 0 541 let g:miniBufExplMapWindowNavVim = 1 542 let g:miniBufExplMapWindowNavArrows = 1 543 let g:miniBufExplMapCTabSwitchBufs = 1 544 let g:miniBufExplModSelTarget = 1 545 let g:miniBufExplMoreThanOne=0 546 547 "BufExplorer 548 set rtp+=~/.vim/bundle/bufexplorer 549 550 let g:bufExplorerShowRelativePath=0 " Show absolute paths. 551 let g:bufExplorerSortBy='extension' 552 let g:bufExplorerSortBy='fullpath' 553 let g:bufExplorerSortBy='mru' 554 let g:bufExplorerSortBy='name' 555 let g:bufExplorerSortBy='number' 556 557 "nmap558 "nmap :BufExplorer 559 "nmap :BufExplorerHorizontalSplit 560 "##################################################################[SuperTab] 561 let g:SuperTabDefaultCompletionType="context" 562 563 "##################################################################[TagbarToggle] 564 let g:tagbar_ctags_bin = 'ctags' 565 let g:tagbar_width = 30 566 567 "##################################################################[mru] 568 set rtp+=~/.vim/bundle/mru 569 let g:MRU_Max_Entries = 1000 570 let g:MRU_Exclude_Files = '^/tmp/.*\|^/var/tmp/.*' " For Unix 571 let g:MRU_Include_Files = '\.c$\|\.h$' 572 let g:MRU_Window_Height = 8 573 "let g:MRU_Use_Current_Window = 1 574 let g:MRU_Auto_Close = 0 575 let g:MRU_Max_Menu_Entries = 20 576 577 "##################################################################[auto-pairs] 578 set runtimepath^=~/.vim/bundle/auto-pairs 579 let g:AutoPairsFlyMode = 1 580 let g:AutoPairsShortcutBackInsert = ' :BufExplorerVerticalSplit ' 581 set laststatus=2 582 "##################################################################[nerdcommenter] "\cc 注释当前行和选中行 583 "\cu 取消注释 584 set rtp+=~/.vim/bundle/nerdcommenter 585 let g:NERDSpaceDelims = 1 586 let g:NERDAltDelims_java = 1 587 let g:NERDCustomDelimiters = { 'c': { 'left': '/**','right': '*/' } } 588 let g:NERDCommentEmptyLines = 1 589 let g:NERDTrimTrailingWhitespace = 1 590 let g:NERDCompactSexyComs = 1 591 592 "##################################################################[ack] 593 set rtp+=~/.vim/bundle/ack.vim 594 let g:ackprg = '~/.vim/shell/xgrep' "find symbols and files. 595 let g:ack_autoclose = 1 596 let g:ackpreview = 1 597 let g:ackhighlight = 1 598 let g:ack_autofold_results = 0 599 let g:ack_lhandler = "botright lopen 8" 600 let g:ack_qhandler = "botright copen 8" 601 602 "##################################################################[resume history] 603 let g:AutoSessionFile = g:Newpwd . "/session.vim" 604 if(expand(g:AutoSessionFile) == findfile(expand(g:AutoSessionFile))) 605 silent :!~/.vim/shell/copy.sh 606 au VimEnter * source ~/.ctags/session.vim 607 endif 608 609 let g:AutoCscopeFile = g:Newpwd . "/cscope.out" 610 if(expand(g:AutoCscopeFile) == findfile(expand(g:AutoCscopeFile))) 611 " 必须这样截取,否则多余的结束符^@会导致cs add 异常. 612 let path = strpart(g:AutoCscopeFile, 0, match(g:AutoCscopeFile, "cscope.out")) 613 let cmd = "cs add " . path . "cscope.out" 614 " echo "path:" path 615 " echo "cmd:" cmd 616 silent: exec cmd 617 endif 618 619 au VimLeave * call LeaveHandler() 620 function! LeaveHandler() 621 if (g:quit_save == 1) 622 let g:path = system("~/.vim/shell/get_path.sh " . shellescape(expand('%:h'))) 623 let execcmd = "mks! ". g:path 624 echo execcmd 625 exec execcmd 626 else 627 echo "exit but no save session.vim" 628 endif 629 endfunction 630 631
现在,基本可以使用vim代替si了 !