歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
Linux教程網 >> Linux編程 >> Linux編程 >> Python 之Vim編寫Python自動補全

Python 之Vim編寫Python自動補全

日期:2017/3/1 9:46:05   编辑:Linux編程

Pydiction :Vim - Python自動補全插件

插件的安裝如下:

1.下載插件包

https://github.com/vim-scripts/Pydiction

可以直接下載,也可git下載

[root@localhost ~]# mkdir zhu

[root@localhost ~]# cd zhu

[root@localhost zhu]# git clone https://github.com/rkulla/pydiction.git

#####################

包括三個文件

python_pydiction.vim #vim插件

complete-dict #python關鍵字和模塊列表,

pydiction.py #python腳本,可以添加更多的模塊


2.配置

#1.查看家目錄下是否有.vim目錄,若沒有則創建。

mkdir -p ~/.vim/after/ftplugin/pydiction

#2.把上面下載的三個文件放到指定的位置

mv python_pydiction.vim ~/.vim/after/ftplugin/

mv complete-dict pydiction.py ~/.vim/after/ftplugin/pydiction/

#3.修改 ~/.vimrc文件,若沒有則創建,在該文件中添加下面兩行。

filetype plugin on

let g:pydiction_location='~/.vim/after/ftplugin/pydiction/complete-dict'

3.編寫一python文件測試

import datetime
datetime
datetime /root/.vim/after/ftplugin/pydiction/complete-dict
datetime.MAXYEAR /root/.vim/after/ftplugin/pydiction/complete-dict
datetime.MINYEAR /root/.vim/after/ftplugin/pydiction/complete-dict
datetime.__doc__ /root/.vim/after/ftplugin/pydiction/complete-dict
datetime.__file__ /root/.vim/after/ftplugin/pydiction/complete-dict
datetime.__name__ /root/.vim/after/ftplugin/pydiction/complete-dict
datetime.__package__ /root/.vim/after/ftplugin/pydiction/complete-dict
datetime.date( /root/.vim/after/ftplugin/pydiction/complete-dict
datetime.datetime( /root/.vim/after/ftplugin/pydiction/complete-dict
datetime.datetime_CAPI /root/.vim/after/ftplugin/pydiction/complete-dict
datetime.time( /root/.vim/after/ftplugin/pydiction/complete-dict
datetime.timedelta( /root/.vim/after/ftplugin/pydiction/complete-dict
datetime.tzinfo( /root/.vim/after/ftplugin/pydiction/complete-dict
date( /root/.vim/after/ftplugin/pydiction/complete-dict
datetime( /root/.vim/after/ftplugin/pydiction/complete-dict
~
~

相關閱讀:在 Vim 中使用 pydiction 對 Python 進行代碼補全 http://www.linuxidc.com/Linux/2013-10/91861.htm

Copyright © Linux教程網 All Rights Reserved