Vim+ ctags + taglist + omnicppcomplete 配置

转自:http://blog.csdn.net/luoweifeng1989/archive/2010/12/11/6069980.aspx

 

1.      安装 VIM

$sudo apt-get install vim-gnome

2.      安装 Ctags

$sudo apt-get install ctags

3.      安装 TagList

$sudo apt-get install vim-scripts

$sudo apt-get install vim-addon-manager

$sudo vim-addons install taglist

.vimrc 里加:

  1. autocmd FileType python  set  omnifunc=pythoncomplete#Complete  
  2. autocmd FileType javascrīpt set  omnifunc=javascrīptcomplete#CompleteJS  
  3. autocmd FileType html set  omnifunc=htmlcomplete#CompleteTags  
  4. autocmd FileType css set  omnifunc=csscomplete#CompleteCSS  
  5. autocmd FileType xml set  omnifunc=xmlcomplete#CompleteTags  
  6. autocmd FileType php set  omnifunc=phpcomplete#CompletePHP  
  7. autocmd FileType c set  omnifunc=ccomplete#Complete  

 

4.      安装omnicppcomplete ( 疯狂补全 )

http://www.vim.org/scripts/download_script.php?src_id=7722

将解压后的文件放入:$HOME/vimfiles

.vimrc 加入

 

 

  1. set  nocp  
  2. filetype plugin on  
 

最后 . 留个配置文件。这样使用 F3 即可打开和关闭 TaglistC+N 自动补全,如果 C+w+wTagList 窗口和编辑窗口切换,想更新 TagList 里边的 Tag ,可以 :w ,然后, C+w+w 切换到 TagList 窗口,使用 u 更新。 OK

  1. "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "  
  2. " by Amix - http://amix.dk/   
  3. "  
  4. " Maintainer: redguardtoo <chb_sh@hotmail.com>, Amir Salihefendic <amix3k at gmail.com>  
  5. " Version: 2.1  
  6. " Last Change: 21/03/08 23:00:01  
  7. " fix some performance issue and syntax bugs  
  8. " Last Change: 12/08/06 13:39:28  
  9. " Fixed (win32 compatible) by: redguardtoo <chb_sh at gmail.com>  
  10. " This vimrc file is  tested on platforms like win32,linux, cygwin,mingw  
  11. " and vim7.0, vim6.4, vim6.1, vim5.8.9 by redguardtoo  
  12. "  
  13. "  
  14. " Tip:  
  15. " If you find anything that you can't understand than do   this :  
  16. " help keyword OR helpgrep keyword  
  17. " Example:  
  18. " Go into command-line mode and type helpgrep nocompatible, ie.  
  19. " :helpgrep nocompatible  
  20. " then press <leader>c to see the results, or :botright cw  
  21. "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "  
  22.   
  23. "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "  
  24. " User configuration  
  25. "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "  
  26. " turn off nice effect on status bar title  
  27. let performance_mode=1  
  28. let use_plugins_i_donot_use=0  
  29. "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "  
  30. " => General  
  31. "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "  
  32. "Get out  of VI's compatible mode..  
  33. set  nocompatible  
  34. function! MySys()  
  35.     if  has( "win32" )  
  36.         return   "win32"   
  37.     elseif has("unix" )  
  38.         return   "unix"   
  39.     else   
  40.         return   "mac"   
  41.     endif  
  42. endfunction  
  43. "Set shell to be bash  
  44. if  MySys() ==  "unix"  || MySys() ==  "mac"   
  45.     set  shell=bash  
  46. else   
  47.     "I have to run win32 python without cygwin  
  48.     "set  shell=E:cygwininsh  
  49. endif  
  50. "Sets how many lines of history VIM har to remember  
  51. set  history=400  
  52. "Enable filetype plugin  
  53. filetype on  
  54. if  has( "eval" ) && v:version>=600  
  55.     filetype plugin on  
  56.     filetype indent on  
  57. endif  
  58. "Set to auto read when a file is  changed from the outside  
  59. if  exists( "&autoread" )  
  60.     set  autoread  
  61. endif  
  62. "Have the mouse enabled all the time:  
  63. if  exists( "&mouse" )  
  64.     set  mouse=a  
  65. endif  
  66. "Set mapleader  
  67. let mapleader = ","   
  68. let g:mapleader = ","   
  69. "Fast saving  
  70. nmap <leader>x :xa!<cr>  
  71. nmap <leader>w :w!<cr>  
  72.   
  73. "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "  
  74. " => Colors and Font  
  75. "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "  
  76. "Enable syntax hl  
  77. if  MySys()== "unix"   
  78.     if  v:version<600  
  79.         if  filereadable(expand( "$VIM/syntax/syntax.vim" ))  
  80.             syntax on  
  81.         endif  
  82.     else   
  83.         syntax on  
  84.     endif  
  85. else   
  86.     syntax on  
  87. endif  
  88. "internationalization  
  89. "I only work in  Win2k Chinese version  
  90. if  has( "multi_byte" )  
  91.     "set  bomb  
  92.   set  fileencodings=ucs-bom,utf-8,cp936,big5,euc-jp,euc-kr,latin1  
  93.   " CJK environment detection and corresponding setting  
  94.   if  v:lang =~  "^zh_CN"   
  95.     " Use cp936 to support GBK, euc-cn == gb2312  
  96.     set  encoding=cp936  
  97.     set  termencoding=cp936  
  98.     set  fileencoding=cp936  
  99.   elseif v:lang =~ "^zh_TW"   
  100.     " cp950, big5 or euc-tw  
  101.     " Are they equal to each other?  
  102.     set  encoding=big5  
  103.     set  termencoding=big5  
  104.     set  fileencoding=big5  
  105.   elseif v:lang =~ "^ko"   
  106.     " Copied from someone's dotfile, untested  
  107.     set  encoding=euc-kr  
  108.     set  termencoding=euc-kr  
  109.     set  fileencoding=euc-kr  
  110.   elseif v:lang =~ "^ja_JP"   
  111.     " Copied from someone's dotfile, untested  
  112.     set  encoding=euc-jp  
  113.     set  termencoding=euc-jp  
  114.     set  fileencoding=euc-jp  
  115.   endif  
  116.   " Detect UTF-8 locale, and replace CJK setting if  needed  
  117.   if  v:lang =~  "utf8$"  || v:lang =~  "UTF-8$"   
  118.     set  encoding=utf-8  
  119.     set  termencoding=utf-8  
  120.     set  fileencoding=utf-8  
  121.   endif  
  122. endif  
  123. "if  you use vim  in  tty,  
  124. "'uxterm -cjk'  or putty with option  'Treat CJK ambiguous characters as wide'  on  
  125. if  exists( "&ambiwidth" )  
  126.     set  ambiwidth= double   
  127. endif  
  128. if  has( "gui_running" )  
  129.     set  guioptions-=m  
  130.     set  guioptions-=T  
  131.     set  guioptions-=l  
  132.     set  guioptions-=L  
  133.     set  guioptions-=r  
  134.     set  guioptions-=R  
  135.     if  MySys()== "win32"   
  136.         "start gvim maximized  
  137.         if  has( "autocmd" )  
  138.             au GUIEnter * simalt ~x  
  139.         endif  
  140.     endif  
  141.     "let psc_style='cool'   
  142.     if  v:version > 601  
  143.         "colorscheme ps_color  
  144.         "colorscheme default   
  145.         colorscheme elflord  
  146.     endif  
  147. else   
  148.     if  v:version > 601  
  149.         "set  background=dark  
  150.         "colorscheme default   
  151.         colorscheme elflord  
  152.     endif  
  153. endif  
  154. "Some nice mapping to switch  syntax (useful  if  one mixes different languages  in  one file)  
  155. map <leader>1 :set  syntax=cheetah<cr>  
  156. map <leader>2 :set  syntax=xhtml<cr>  
  157. map <leader>3 :set  syntax=python<cr>  
  158. map <leader>4 :set  ft=javascript<cr>  
  159. map <leader>$ :syntax sync fromstart<cr>  
  160. "Highlight current  
  161. if  has( "gui_running" )  
  162.     if  exists( "&cursorline" )  
  163.         set  cursorline  
  164.     endif  
  165. endif  
  166. "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "  
  167. " => Fileformat  
  168. "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "  
  169. "Favorite filetype  
  170. set  ffs=unix,dos,mac  
  171. nmap <leader>fd :se ff=dos<cr>  
  172. nmap <leader>fu :se ff=unix<cr>  
  173.   
  174. "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "  
  175. " => VIM userinterface  
  176. "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "  
  177. "Set 7 lines to the curors - when moving vertical..  
  178. set  so=7  
  179. "Turn on WiLd menu  
  180. set  wildmenu  
  181. "Always show current position  
  182. set  ruler  
  183. "The commandbar is  2 high  
  184. set  cmdheight=2  
  185. "Show line number  
  186. set  nu  
  187. "Do not redraw, when running macros.. lazyredraw  
  188. set  lz  
  189. "Change buffer - without saving  
  190. set  hid  
  191. "Set backspace  
  192. set  backspace=eol,start,indent  
  193. "Bbackspace and cursor keys wrap to  
  194. set  whichwrap+=<,>,h,l  
  195. "Ignore case  when searching  
  196. "set  ignorecase  
  197. set  incsearch  
  198. "Set magic on  
  199. set  magic  
  200. "No sound on errors.  
  201. set  noerrorbells  
  202. set  novisualbell  
  203. set  t_vb=  
  204. "show matching bracet  
  205. set  showmatch  
  206. "How many tenths of a second to blink  
  207. set  mat=8  
  208. "Highlight search thing  
  209. set  hlsearch  
  210. "" "" "" "" "" "" "" "" "" "" "" "" "" "" ""   
  211. " => Statusline  
  212. "" "" "" "" "" "" "" "" "" "" "" "" "" "" ""   
  213. "Format the statusline  
  214. " Nice statusbar  
  215. if  performance_mode  
  216. else   
  217.     set  laststatus=2  
  218.     set  statusline=  
  219.     set  statusline+=%2*%-3.3n%0*/ " buffer number  
  220.     set  statusline+=%f/ " file name  
  221.     set  statusline+=%h%1*%m%r%w%0* " flags  
  222.     set  statusline+=[  
  223.     if  v:version >= 600  
  224.         set  statusline+=%{strlen(&ft)?&ft: 'none' }, " filetype  
  225.         set  statusline+=%{&encoding}, " encoding  
  226.     endif  
  227.     set  statusline+=%{&fileformat}] " file format  
  228.     if  filereadable(expand( "$VIM/vimfiles/plugin/vimbuddy.vim" ))  
  229.         set  statusline+=/ %{VimBuddy()} " vim buddy  
  230.     endif  
  231.     set  statusline+=%= " right align  
  232.     set  statusline+=%2*0x%-8B/ " current  char   
  233.     set  statusline+=%-14.(%l,%c%V%)/ %<%P " offset  
  234.     " special statusbar for  special windows  
  235.     if  has( "autocmd" )  
  236.         au FileType qf  
  237.                     / if  &buftype ==  "quickfix"  |  
  238.                     / setlocal statusline=%2*%-3.3n%0* |  
  239.                     / setlocal statusline+=/ /[Compiler/ Messages/] |  
  240.                     / setlocal statusline+=%=%2*/ %<%P |  
  241.                     / endif  
  242.         fun! FixMiniBufExplorerTitle()  
  243.             if   "-MiniBufExplorer-"  == bufname( "%" )  
  244.                 setlocal statusline=%2*%-3.3n%0*  
  245.                 setlocal statusline+=/[Buffers/]  
  246.                 setlocal statusline+=%=%2*/ %<%P  
  247.             endif  
  248.         endfun  
  249.         if  v:version>=600  
  250.             au BufWinEnter *  
  251.                         / let oldwinnr=winnr() |  
  252.                         / windo call FixMiniBufExplorerTitle() |  
  253.                         / exec oldwinnr . " wincmd w"   
  254.         endif  
  255.     endif  
  256.     " Nice window title  
  257.     if  has( 'title' ) && (has( 'gui_running' ) || &title)  
  258.         set  titlestring=  
  259.         set  titlestring+=%f/ " file name  
  260.         set  titlestring+=%h%m%r%w " flags  
  261.         set  titlestring+=/ -/ %{v:progname} " program name  
  262.     endif  
  263. endif  
  264.   
  265. "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "  
  266. " => Moving around and tab  
  267. "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "  
  268. "Map space to / and c-space to ?  
  269. map <space> /  
  270. "Smart way to move btw. window  
  271. map <C-j> <C-W>j  
  272. map <C-k> <C-W>k  
  273. map <C-h> <C-W>h  
  274. map <C-l> <C-W>l  
  275.   
  276. "Tab configuration  
  277. map <leader>tn :tabnew %<cr>  
  278. map <leader>tc :tabclose<cr>  
  279. map <leader>tm :tabmove  
  280. if  v:version>=700  
  281.     set  switchbuf=usetab  
  282. endif  
  283. if  exists( "&showtabline" )  
  284.     set  stal=2  
  285. endif  
  286. "Moving fast to front, back and 2 sides ;)  
  287. imap <m-$> <esc>$a  
  288. imap <m-0> <esc>0i  
  289. imap <D-$> <esc>$a  
  290. imap <D-0> <esc>0i  
  291.   
  292. "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "  
  293. " => General Autocommand  
  294. "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "  
  295. "Switch to current dir  
  296. map <leader>cd :cd %:p:h<cr>  
  297.   
  298. "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "  
  299. " => Parenthesis/bracket expanding  
  300. "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" ""   
  301. vnoremap $1 <esc>`>a)<esc>`<i(<esc>  
  302. ")  
  303. vnoremap $2 <esc>`>a]<esc>`<i[<esc>  
  304. vnoremap $3 <esc>`>a}<esc>`<i{<esc>  
  305. vnoremap $ <esc>`>a"<esc>`<i" <esc>  
  306. vnoremap $q <esc>`>a'<esc>`<i' <esc>  
  307. vnoremap $w <esc>`>a"<esc>`<i" <esc>  
  308. "Map auto complete of (, " , ', [  
  309. "http://www.vim.org/tips/tip.php?tip_id=153   
  310. "  
  311. "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "  
  312. " => General Abbrev  
  313. "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "  
  314. "Comment for  C like language  
  315. if  has( "autocmd" )  
  316.     au BufNewFile,BufRead *.js,*.htc,*.c,*.tmpl,*.css ino $c /**<cr> **/ <esc>O  
  317. endif  
  318. "My information  
  319. ia xdate <c-r>=strftime("%d/%m/%y %H:%M:%S" )<cr>  
  320. "iab xname Amir Salihefendic  
  321. "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "  
  322. " => Editing mappings etc.  
  323. "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "  
  324. "Remap VIM 0  
  325. map 0 ^  
  326. "Move a line of text using  control  
  327. nmap <M-j> mz:m+<cr>`z  
  328. nmap <M-k> mz:m-2<cr>`z  
  329. vmap <M-j> :m'>+<cr>`<my`>mzgv`yo`z  
  330. vmap <M-k> :m'<-2<cr>`>my`<mzgv`yo`z  
  331. if  MySys() ==  "mac"   
  332.     nmap <D-j> <M-j>  
  333.     nmap <D-k> <M-k>  
  334.     vmap <D-j> <M-j>  
  335.     vmap <D-k> <M-k>  
  336. endif  
  337.   
  338. "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "  
  339. " => Command-line config  
  340. "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "  
  341. func! Cwd()  
  342.     let cwd = getcwd()  
  343.     return   "e "  . cwd  
  344. endfunc  
  345. func! DeleteTillSlash()  
  346.     let g:cmd = getcmdline()  
  347.     if  MySys() ==  "unix"  || MySys() ==  "mac"   
  348.         let g:cmd_edited = substitute(g:cmd, "(.*[/]).*""""" )  
  349.     else   
  350.         let g:cmd_edited = substitute(g:cmd, "(.*[/]).*""""" )  
  351.     endif  
  352.     if  g:cmd == g:cmd_edited  
  353.         if  MySys() ==  "unix"  || MySys() ==  "mac"   
  354.             let g:cmd_edited = substitute(g:cmd, "(.*[/]).*/""""" )  
  355.         else   
  356.             let g:cmd_edited = substitute(g:cmd, "(.*[/]).*[/]""""" )  
  357.         endif  
  358.     endif  
  359.     return  g:cmd_edited  
  360. endfunc  
  361. func! CurrentFileDir(cmd)  
  362.     return  a:cmd .  " "  . expand( "%:p:h" ) .  "/"   
  363. endfunc  
  364. "cno $q <C->eDeleteTillSlash()<cr>  
  365. "cno $c e <C->eCurrentFileDir(" e")<cr>  
  366. "cno $tc <C->eCurrentFileDir(" tabnew")<cr>  
  367. cno $th tabnew ~/  
  368. cno $td tabnew ~/Desktop/  
  369. "Bash like  
  370. cno <C-A> <Home>  
  371. cno <C-E> <End>  
  372. cno <C-K> <C-U>  
  373.   
  374. "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "  
  375. " => Buffer realted  
  376. "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "  
  377. "Fast open a buffer by search for  a name  
  378. "map <c-q> :sb  
  379. "Open a dummy buffer for  paste  
  380. map <leader>q :e ~/buffer<cr>  
  381. "Restore cursor to file position in  previous editing session  
  382. set  viminfo='10,"100,:20,%,n~/.viminfo  
  383. " Buffer - reverse everything ... :)  
  384. map <F9> ggVGg?  
  385. "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "  
  386. " => Files and backup  
  387. "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "  
  388. "Turn backup off  
  389. set  nobackup  
  390. set  nowb  
  391. "set  noswapfile  
  392. "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "  
  393. " => Folding  
  394. "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "  
  395. "Enable folding, I find it very useful  
  396. if  exists( "&foldenable" )  
  397.     set  fen  
  398. endif  
  399. if  exists( "&foldlevel" )  
  400.     set  fdl=0  
  401. endif  
  402. "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "  
  403. " => Text option  
  404. "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "  
  405. " python script  
  406. "set  expandtab  
  407. set  shiftwidth=2  
  408. set  softtabstop=2  
  409. set  tabstop=2  
  410. set  backspace=2  
  411. set  smarttab  
  412. set  lbr  
  413. "set  tw=500  
  414. "" "" "" "" "" "" "" "" "" "" "" "" "" "" ""   
  415. " => Indent  
  416. "" "" "" "" "" "" "" "" "" "" "" "" "" "" ""   
  417. "Auto indent  
  418. set  ai  
  419. "Smart indet  
  420. set  si  
  421. "C-style indenting  
  422. if  has( "cindent" )  
  423.     set  cindent  
  424. endif  
  425. "Wrap line  
  426. set  wrap  
  427.   
  428. "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "  
  429. " => Spell checking  
  430. "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "  
  431. map <leader>sn ]  
  432. map <leader>sp [  
  433. map <leader>sa zg  
  434. map <leader>s? z=  
  435.   
  436. "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "  
  437. " => Plugin configuration  
  438. "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "  
  439. "" "" "" "" "" "" "" "" "" "" "" "" "" "" ""   
  440. " => Yank Ring  
  441. "" "" "" "" "" "" "" "" "" "" "" "" "" "" ""   
  442. if  use_plugins_i_donot_use  
  443.     map <leader>y :YRShow<cr>  
  444.     "" "" "" "" "" "" "" "" "" "" "" "" "" "" ""   
  445.     " => File explorer  
  446.     "" "" "" "" "" "" "" "" "" "" "" "" "" "" ""   
  447.     "Split vertically  
  448.     let g:explVertical=1  
  449.     "Window size  
  450.     let g:explWinSize=35  
  451.     let g:explSplitLeft=1  
  452.     let g:explSplitBelow=1  
  453.     "Hide some file  
  454.     let g:explHideFiles='^.,.*.class $,.*.swp$,.*.pyc$,.*.swo$,.DS_Store</span></p>  
  455. <p class = "MsoNormal"  style= ""  id= "" ><span lang= "EN-US"  style= "" ><o:p style= "" > </o:p></span></p><p></p>  
  456.     "Hide the help thing..  
  457.     let g:explDetailedHelp=0  
  458.   
  459.     "" "" "" "" "" "" "" "" "" "" "" "" "" "" ""   
  460.     " => Minibuffer  
  461.     "" "" "" "" "" "" "" "" "" "" "" "" "" "" ""   
  462.     let g:miniBufExplModSelTarget = 1  
  463.     let g:miniBufExplorerMoreThanOne = 0  
  464.     let g:miniBufExplModSelTarget = 0  
  465.     let g:miniBufExplUseSingleClick = 1  
  466.     let g:miniBufExplMapWindowNavVim = 1  
  467.     let g:miniBufExplVSplit = 25  
  468.     let g:miniBufExplSplitBelow=1  
  469.     "WindowZ  
  470.     map <c-w><c-t> :WMToggle<cr>  
  471.     let g:bufExplorerSortBy = "name"   
  472.     "" "" "" "" "" "" "" "" "" "" "" "" "" "" ""   
  473.     " => LaTeX Suite thing  
  474.     "" "" "" "" "" "" "" "" "" "" "" "" "" "" ""   
  475.     "set  grepprg=grep -r -s -n  
  476.     let g:Tex_DefaultTargetFormat="pdf"   
  477.     let g:Tex_ViewRule_pdf='xpdf'   
  478.     if  has( "autocmd" )  
  479.         "Binding  
  480.         au BufRead *.tex map <silent><leader><space> :w!<cr> :silent! call Tex_RunLaTeX()<cr>  
  481.         "Auto complete some things ;)  
  482.         au BufRead *.tex ino <buffer> $i indent  
  483.         au BufRead *.tex ino <buffer> $* cdot  
  484.         au BufRead *.tex ino <buffer> $i item  
  485.         au BufRead *.tex ino <buffer> $m [<cr>]<esc>O  
  486.     endif  
  487. endif  
  488. "" "" "" "" "" "" "" "" "" "" "" "" "" "" ""   
  489. " => Tag list (ctags) - not used  
  490. "" "" "" "" "" "" "" "" "" "" "" "" "" "" ""   
  491. "let Tlist_Ctags_Cmd = " /sw/bin/ctags-exuberant"  
  492. "let Tlist_Sort_Type = " name"  
  493. "let Tlist_Show_Menu = 1  
  494. "map <leader>t :Tlist<cr>  
  495. map <F3> :Tlist<cr>  
  496.   
  497. "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "  
  498. " => Filetype generic  
  499. "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "  
  500. "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "  
  501. " => Todo  
  502. "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "  
  503. "au BufNewFile,BufRead *.todo so ~/vim_local/syntax/amido.vim  
  504. "" "" "" "" "" "" "" "" "" "" "" "" "" "" ""   
  505. " => VIM  
  506. "" "" "" "" "" "" "" "" "" "" "" "" "" "" ""   
  507. if  has( "autocmd" ) && v:version>600  
  508.     au BufRead,BufNew *.vim map <buffer> <leader><space> :w!<cr>:source %<cr>  
  509. endif  
  510. "" "" "" "" "" "" "" "" "" "" "" "" "" "" ""   
  511. " => HTML related  
  512. "" "" "" "" "" "" "" "" "" "" "" "" "" "" ""   
  513. " HTML entities - used by xml edit plugin  
  514. let xml_use_xhtml = 1  
  515. "let xml_no_auto_nesting = 1  
  516. "To HTML  
  517. let html_use_css = 0  
  518. let html_number_lines = 0  
  519. let use_xhtml = 1  
  520.   
  521. "" "" "" "" "" "" "" "" "" "" "" "" "" "" ""   
  522. " => Ruby & PHP section  
  523. "" "" "" "" "" "" "" "" "" "" "" "" "" "" ""   
  524. "" "" "" "" "" "" "" "" "" "" "" "" "" "" ""   
  525. " => Python section  
  526. "" "" "" "" "" "" "" "" "" "" "" "" "" "" ""   
  527. "" Run the current buffer  in  python - ie. on leader+space  
  528. "au BufNewFile,BufRead *.py so ~/vim_local/syntax/python.vim  
  529. "au BufNewFile,BufRead *.py map <buffer> <leader><space> :w!<cr>:!python %<cr>  
  530. "au BufNewFile,BufRead *.py so ~/vim_local/plugin/python_fold.vim  
  531. "" Set some bindings up  for   'compile'  of python  
  532. "au BufNewFile,BufRead *.py set makeprg=python -c " import py_compile,sys; sys.stderr=sys.stdout; py_compile.compile(r '%' )"  
  533. "au BufNewFile,BufRead *.py set efm=%C %.%#,%A File " %f", line %l%.%#,%Z%[%^ ]%@=%m  
  534. "au BufNewFile,BufRead *.py nmap <buffer> <F8> :w!<cr>:make<cr>  
  535. "" Python iMap  
  536. "au BufNewFile,BufRead *.py set  cindent  
  537. "au BufNewFile,BufRead *.py ino <buffer> $r return   
  538. "au BufNewFile,BufRead *.py ino <buffer> $s self  
  539. "au BufNewFile,BufRead *.py ino <buffer> $c ##<cr>#<space><cr>#<esc>kla  
  540. "au BufNewFile,BufRead *.py ino <buffer> $i import  
  541. "au BufNewFile,BufRead *.py ino <buffer> $p print  
  542. "au BufNewFile,BufRead *.py ino <buffer> $d " "" <cr> "" "<esc>O  
  543. "" Run  in  the Python interpreter  
  544. "function! Python_Eval_VSplit() range  
  545. " let src = tempname()  
  546. " let dst = tempname()  
  547. " execute "" . a:firstline . " , " . a:lastline . " w " . src  
  548. " execute " :!python  " . src . "  > " . dst  
  549. " execute " :pedit! " . dst  
  550. "endfunction  
  551. "au BufNewFile,BufRead *.py vmap <F7> :call Python_Eval_VSplit()<cr>  
  552.   
  553. "" "" "" "" "" "" "" "" "" "" "" "" "" "" ""   
  554. " => Cheetah section  
  555. "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "  
  556. "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "  
  557. " => Java section  
  558. "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "  
  559. "" "" "" "" "" "" "" "" "" "" "" "" "" "" ""   
  560. " => JavaScript section  
  561. "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "  
  562. "au BufNewFile,BufRead *.js so ~/vim_local/syntax/javascript.vim  
  563. "function! JavaScriptFold()  
  564. set  foldmethod=marker  
  565. set  foldmarker={,}  
  566. set  foldtext=getline(v:foldstart)  
  567. "endfunction  
  568. "au BufNewFile,BufRead *.js call JavaScriptFold()  
  569. "au BufNewFile,BufRead *.js imap <c-t> console.log();<esc>hi  
  570. "au BufNewFile,BufRead *.js imap <c-a> alert();<esc>hi  
  571. "au BufNewFile,BufRead *.js set  nocindent  
  572. "au BufNewFile,BufRead *.js ino <buffer> $r return   
  573. "au BufNewFile,BufRead *.js ino <buffer> $d //<cr>//<cr>//<esc>ka<space>   
  574. "au BufNewFile,BufRead *.js ino <buffer> $c /**<cr><space><cr>**/ <esc>ka  
  575.   
  576. if  has( "eval" ) && has( "autocmd" )  
  577.     "vim 5.8.9 on mingw donot know what is  <SID>, so I avoid to use function  
  578.     "c/cpp  
  579.     fun! Abbrev_cpp()  
  580.         ia <buffer> cci const_iterator  
  581.         ia <buffer> ccl cla  
  582.         ia <buffer> cco const   
  583.         ia <buffer> cdb bug  
  584.         ia <buffer> cde throw   
  585.         ia <buffer> cdf /** file<CR><CR>/<Up>  
  586.         ia <buffer> cdg ingroup  
  587.         ia <buffer> cdn /** Namespace <namespace <CR><CR>/<Up>  
  588.         ia <buffer> cdp param  
  589.         ia <buffer> cdt test  
  590.         ia <buffer> cdx /**<CR><CR>/<Up>  
  591.         ia <buffer> cit iterator  
  592.         ia <buffer> cns Namespace ianamespace  
  593.         ia <buffer> cpr protected   
  594.         ia <buffer> cpu public   
  595.         ia <buffer> cpv private   
  596.         ia <buffer> csl std::list  
  597.         ia <buffer> csm std::map  
  598.         ia <buffer> css std::string   
  599.         ia <buffer> csv std::vector  
  600.         ia <buffer> cty typedef  
  601.         ia <buffer> cun using  Namespace ianamespace  
  602.         ia <buffer> cvi virtual   
  603.         ia <buffer> #i #include  
  604.         ia <buffer> #d #define  
  605.     endfunction  
  606.     fun! Abbrev_java()  
  607.         ia <buffer> #i import  
  608.         ia <buffer> #p System.out .println  
  609.         ia <buffer> #m public   static   void  main(String[] args)  
  610.     endfunction  
  611.     fun! Abbrev_python()  
  612.         ia <buffer> #i import  
  613.         ia <buffer> #p print  
  614.         ia <buffer> #m if  __name__== "__main__" :  
  615.     endfunction  
  616.     fun! Abbrev_aspvbs()  
  617.         ia <buffer> #r Response.Write  
  618.         ia <buffer> #q Request.QueryString  
  619.         ia <buffer> #f Request.Form  
  620.     endfunction  
  621.     fun! Abbrev_js()  
  622.         ia <buffer> #a if (!0){ throw  Error(callStackInfo());}  
  623.     endfunction  
  624.     augroup abbreviation  
  625.         au!  
  626.         au FileType javascript :call Abbrev_js()  
  627.         au FileType cpp,c :call Abbrev_cpp()  
  628.         au FileType java :call Abbrev_java()  
  629.         au FileType python :call Abbrev_python()  
  630.         au FileType aspvbs :call Abbrev_aspvbs()  
  631.     augroup END  
  632. endif  
  633. "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "  
  634. " => MISC  
  635. "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "  
  636. "Remove the Windows ^M  
  637. noremap <leader>m :%s//r//g<CR>   
  638. "Paste toggle - when pasting something in , don't indent.  
  639. "set  pastetoggle=<F3>  
  640. "Remove indenting on empty line  
  641. map <F2> :%s/s*$//g<cr>:noh<cr>''   
  642. "Super paste  
  643. ino <C-v> <esc>:set  paste<cr>mui<C-R>+<esc>mv 'uV' v=: set  nopaste<cr>  
  644. "clipboard with xclip  
  645. if  MySys() ==  "unix"   
  646.     vmap <F6> :!xclip -sel c<CR>  
  647.     map <F7> :-1r!xclip -o -seln c<CR>'z  
  648. endif  
  649.   
  650. "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "  
  651. autocmd FileType python set  omnifunc=pythoncomplete#Complete  
  652. autocmd FileType javascript set  omnifunc=javascriptcomplete#CompleteJS  
  653. autocmd FileType html set  omnifunc=htmlcomplete#CompleteTags  
  654. autocmd FileType css set  omnifunc=csscomplete#CompleteCSS  
  655. autocmd FileType xml set  omnifunc=xmlcomplete#CompleteTags  
  656. autocmd FileType php set  omnifunc=phpcomplete#CompletePHP  
  657. autocmd FileType c set  omnifunc=ccomplete#Complete  
  658.   
  659. set  nocp  
  660. filetype plugin on  
  661. let Tlist_Exit_OnlyWindow=1 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值