linux下vim python代码自动补全

时间:2023-03-08 17:54:01

一、vim python自动补全插件:pydiction

可以实现下面python代码的自动补全:
1.简单python关键词补全
2.python 函数补全带括号
3.python 模块补全
4.python 模块内函数,变量补全
5.from module import sub-module 补全

插件地址:https://github.com/rkulla/pydiction

wget https://github.com/rkulla/pydiction/archive/master.zip
yum install -y unzip tree
unzip -q master
mv pydiction-master pydiction
mkdir -p ~/.vim/tools/pydiction
cp -r pydiction/after ~/.vim
cp pydiction/complete-dict ~/.vim/tools/pydiction

# tree ~/.vim
/root/.vim
├── after
│ └── ftplugin
│ └── python_pydiction.vim
└── tools
└── pydiction
└── complete-dict
创建~/.vimrc,确保其中内容如下:
[ceo-xsec ~]# cat ~/.vimrc
filetype plugin on
let g:pydiction_location = ‘~/.vim/tools/pydiction/complete-dict’

然后创建一个.py文件测试可以

linux下vim python代码自动补全