vim python自动补全功能

1. 安装完整的vim

# apt-get install vim-gnome

2. 安装ctags,ctags用于支持taglist,必需!

# apt-get install ctags

3. 安装taglist

#apt-get install vim-scripts

#apt-get install vim-addon-manager

// 貌似我在安装vim-scripts的时候,已经附带安装了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

// ~/.vim/after/ftplugin和~/.vim/tools/pydiction/目录默认不存在,需要自行创建

#cp pydiction-1.2/python_pydiction.vim ~/.vim/after/ftplugin

#cp pydiction-1.2/complete-dict ~/.vim/tools/pydiction/complete-dict

5. 编辑配置文件

# vim ~/.vimrc

以下是配置文件的内容:

[html]  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 autoindent  
  25. set tabstop=4    
  26. set shiftwidth=4    
  27. set expandtab    
  28. set number  

其中,

filetype plugin on:表示开启插件。

let g:pydiction_location='~/.vim/tools/pydiction/complete-dict' : 写入你存放complete-dict的绝对路径。


参考:

http://www.350351.com/bianchengyuyan/Python/344419.html

http://www.cnblogs.com/Bonker/p/4058728.html

https://www.zhihu.com/question/20381207

http://blog.csdn.net/u010388829/article/details/41846235


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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值