pydiction用来实现代码补全和语法提示功能。pydiction不能通过apt安装,需要自行下载安装。
在GitHub下载源码,可以使用Git迁出到本地,或者下载zip包自行解压,地址为:https://github.com/rkulla/pydiction
pydiction可以让vim自动补全Python代码,无论是关键字,标准库还是第三方库。它主要包含3个文件:
python_pydiction.vim: vim插件文件。
complete-dict: 一个字典文件,包含了Python的关键字和模块。插件引用的内容即来自于此。
pydiction.py: 一个py脚本,运行此文件可以增加新的模块到complete-dict字典中。
如何安装?
Linux/Unix系统:将python_pydiction.vim文件复制到 ~/.vim/after/ftplugin 目录下。如果该目录不存在,则创建它,vim会自动在此目录下搜索。
除此之外的另两个文件complete-dict和pydiction.py可以放置到任何你想放置的位置,我是在.VIM下新建一个tools文件夹 把git下的 pydiction文件夹放进去的
5. 编辑配置文件
编辑~/.vimrc文件,如果不存在则创建。添加以下内容:
let Tlist_Auto_Highlight_Tag=1
let Tlist_Auto_Open=1
let Tlist_Auto_Update=1
let Tlist_Display_Tag_Scope=1
let Tlist_Exit_OnlyWindow=1
let Tlist_Enable_Dold_Column=1
let Tlist_File_Fold_Auto_Close=1
let Tlist_Show_One_File=1
let Tlist_Use_Right_Window=1
let Tlist_Use_SingleClick=1
nnoremap <silent> <F8> :TlistToggle<CR>
filetype plugin on
autocmd FileType python set omnifunc=pythoncomplete#Complete
autocmd FileType javascrīpt set omnifunc=javascriptcomplete#CompleteJS
autocmd FileType html set omnifunc=htmlcomplete#CompleteTags
autocmd FileType css set omnifunc=csscomplete#CompleteCSS
autocmd FileType xml set omnifunc=xmlcomplete#CompleteTags
autocmd FileType php set omnifunc=phpcomplete#CompletePHP
autocmd FileType c set omnifunc=ccomplete#Complete
let g:pydiction_location='~/.vim/tools/pydiction/complete-dict'
set autoindent
set tabstop=4
set shiftwidth=4
set expandtab
set number
filetype plugin on:表示开启插件。
let g:pydiction_location='~/.vim/tools/pydiction/complete-dict' : 写入你存放complete-dict的绝对路径。
原文链接:https://www.cnblogs.com/Bonker/p/4058728.html
参考pydiction 的git主页 :https://github.com/rkulla/pydiction