原帖在这里.
http://topic.csdn.net/u/20100817/12/3d29573a-19db-4b72-81f7-6dc70ca40c96.html
如果只是使用python3这个应该够用了.
考虑到还有很多同学在用2.x, 所以新版同时支持2.x/3.x, 下载地址
http://www.vim.org/scripts/script.php?script_id=3212 (英语太烂了..)
安装方法: 压缩包里有4个文件
python_showpydoc_2.vim只用于python2.x(需要+python 或 +python/dyn)
python_showpydoc_3.vim只用于python3(需要+python3 或 + python3/dyn)
两者不可以共存.
如果需要同时支持两种版本可以使用python_showpydoc.vim和ShowPyDoc_PSD117.py
(需要+python / +python3 或 +python/dyn / +python3/dyn, 注意linux/unix下gvim对动态加载的支持上好象有点问题)
根据需要将它们拷贝到ftplugin目录即可.
python_showpydoc_2.vim和python_showpydoc_3.vim直接用就好了.
介绍下在同时支持两个版本时如何互相切换:
命令: SpydocSV version
用于切换当前buffer的python版本, version可以是py或py3, 分别代表2.x与3.x
当version为任何其他值时将显示当前buffer的版本.
注意此命令只影响当前buffer, 即每个buffer都可以有自己的python版本. 查询时彼此不受影响.
选项: g:showpydoc_selected_version(取值"py"或"py3"默认"py")
当初次打开一个文件时采用它作为默认python版本. 随后可以调用SpydocSV修改之.
一些例子:
比如我们有个python脚本:
import sys;
form sys import path;
import httplib;
import http.client;
class Test(object): pass;
t = Test();
然后输入以下命令
:SpydocSV ver
current python version is: py
:Spydoc sys
sys document(module)
:Spydoc sys.exit
sys.exit document(function)
:Spydoc sys.path
type of sys.path(built-in type list)
:Spydoc path
type of os.path(same as above)
:Spydoc http.client
error: name 'http' is not define
:SpydocSV py3
:Spydoc http.client
http.client doc
:Spydoc httplib
error: name 'httplib' is not define
:SpydocSV py
:Spydoc httplib
httplib doc
:Spydoc Test:
error: name 'Test' is not define
:Spydoc t:
error: name 't' is not define
:Spydoc sys.ss
error: 'module' object has no attribute 'ss'
:Spydoc sys.exit()
error: 'sys.exit()' is a wrong?