从此使用vim代替si看代码

前端之家收集整理的这篇文章主要介绍了从此使用vim代替si看代码前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
以前是在windows下的开发环境,最好用的看代码代码工具当然是非source insight莫属了,所以一直以来都是用si写代码,分析代码
后面转入linux开发环境后一直也是用si(通过wine安装)但是很不稳定,经常会出各种问题死掉。所以决定切换用vim来代替si,vim号称程序员最好用的代码编辑器,再说了,作为一个混迹多年江湖的程序猿,不去好好感受下这么优秀工具,岂不是暴殄天物?

网上找了很多资料,终于搭建了自己的 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


相关快捷键配置:

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


现在,基本可以使用vim代替si了 !

猜你在找的Bash相关文章