【转】vim 配置

原帖地址http://blog.csdn.net/luoweifeng1989/article/details/6610133

 

VIM 配置Python开发环境 Taglist + Pydiction+Hightlight+Python_fold + NERD_TREE+.....

Luo weifeng 2011-7-16

1.      安装完整的VIM

#apt-get install vim-gnome

2.      安装Ctags

#apt-get install ctags

3.      安装TagList

#apt-get install vim-scripts

#apt-get install vim-addon-manager

# vim-addons install taglist

4.      安装最新版pydiction      

#wget http://www.pythonclub.org/_media/python-basic/pydiction-1.2.zip 
#unzip pydiction-1.2.zip
5.    编辑配置文件
#vim ~/.vimrc
[plain]  view plain copy
  1. let Tlist_Auto_Highlight_Tag=1  
  2. let Tlist_Auto_Open=1  
  3. let Tlist_Auto_Update=1  
  4. let Tlist_Display_Tag_Scope=1  
  5. let Tlist_Exit_OnlyWindow=1  
  6. let Tlist_Enable_Dold_Column=1  
  7. let Tlist_File_Fold_Auto_Close=1  
  8. let Tlist_Show_One_File=1  
  9. let Tlist_Use_Right_Window=1  
  10. let Tlist_Use_SingleClick=1  
  11. nnoremap <silent> <F8> :TlistToggle<CR>  
  12.   
  13. filetype plugin on  
  14. autocmd FileType python set omnifunc=pythoncomplete#Complete  
  15. autocmd FileType javascrīpt set omnifunc=javascriptcomplete#CompleteJS  
  16. autocmd FileType html set omnifunc=htmlcomplete#CompleteTags  
  17. autocmd FileType css set omnifunc=csscomplete#CompleteCSS  
  18. autocmd FileType xml set omnifunc=xmlcomplete#CompleteTags  
  19. autocmd FileType php set omnifunc=phpcomplete#CompletePHP  
  20. autocmd FileType c set omnifunc=ccomplete#Complete  
  21.   
  22.   
  23. let g:pydiction_location='~/.vim/tools/pydiction/complete-dict'  
  24. set tabstop=4  
  25. set shiftwidth=4  
  26. set expandtab  
  27. set number  

6.  享用吧

使用F8打开或关闭taglist窗口。 C-w w在taglist与code之间切换。 
示例:
在code窗口定义几个函数。使用:w 保存。使用 C-w w切换到taglist窗口,输入u 更新taglist列表。使用 j k或者up down键定位到特定tag上,使用t 定位到code里边tag定义的地方并且切换光标到此,使用p定位到code定义tag的地方,光标不切换回去。 使用tab补全标准库或函数或关键词,使用C-N补全自定义的变量等。tab会被替换成4个空格。

有图有真相:


附加:highlight
http://www.vim.org/scripts/script.php?script_id=1599Line mode 
<C-h><C-h>   Highlight current line 
<C-h><C-a>   Advance color for next line highlight 
<C-h><C-r>   Clear last line highlight 

Pattern mode 
<C-h><C-w>   Highlight word under cursor (whole word match) 
<C-h><C-l>    Highlight all lines having word under cursor (whole word match) 
<C-h><C-f>    Highlight word under cursor (partial word match) 
<C-h><C-k>   Highlight all lines having word under cursor (partial word match) 
<C-h><C-s>   Highlight last search pattern 
<C-h><C-j>    Highlight all lines having last search pattern 
<C-h><C-d>   Clear last pattern highlight 

<C-h><C-n>   Clear all highlights 

All above commands work in both normal & insert modes. 
<C-h><C-h> also works in visual mode. (Select desired lines & hit <C-h><C-h>) 




python_fold自动折叠

http://vim.sourceforge.net/scripts/script.php?script_id=515 

zo 展开 

zc 收起 
zn 全部展开 
zN 全部折叠

NERD_TREE 目录树(强烈推荐)

安装方法如下:
1.下载插件文件

http://www.vim.org/scripts/script.php?script_id=1658

解压文件到~/.vim/目录下,如果没有此目录,则要自己创建。

2.添加配置文件
在~/.vimrc 或 /etc/vim/vimrc文件里添加如下配置
“”"”"”"”"”"”"”"”"”"”"”"”"”"”"”"”"”"”"”"”"”"”"”"”"”"”"”"”"”"”"”"”"”"”"
” F7 NERDTree
“”"”"”"”"”"”"”"”"”"”"”"”"”"”"”"”"”"”"”"”"”"”"”"”"”"”"”"”"”"”"”"”"”"”"
map <F7> :NERDTreeToggle<CR>
imap <F7> <ESC>:NERDTreeToggle<CR>

则在VIM里按下F7就可打开关闭目录树。具体操作命令请查看插件doc目录下的帮助文件。

 

Auto Complete 这个比较霸气

http://www.vim.org/scripts/script.php?script_id=1879

 

minibuffer

http://www.vim.org/scripts/script.php?script_id=159

猜你喜欢

转载自pako.iteye.com/blog/1765621