Pythonising the vim (e.g. syntax popups) -> vimpst
sjdevnull at yahoo.com
sjdevnull at yahoo.com
Thu Nov 10 12:40:35 EST 2005
sjdevnull at yahoo.com wrote:
> 2. Failing that, look in a help dictionary; I generated mine from the
> info version of the Python docs, using a simple Python script.
Which is as follows (run on all the python-lib*info* files and it'll
generate a file called "output"; rename that to ~/.vim/pyhelp.py)
import sys
docDict = {}
for file in sys.argv[1:]:
lines = open(file, "r").readlines()
for i in range(len(lines)):
line = lines[i].strip()
if line.startswith("`") and "(" in line and line.endswith("'"):
line = line[1:-1]
kv = line[0:line.find("(")]
j = i
while j < len(lines) and lines[j+1].startswith(" "):
j = j+1
line = line + " "+lines[j].strip()
if kv and kv not in docDict:
docDict[kv] = line
keys = docDict.keys()
keys.sort()
for k in keys:
print docDict[k]
open("output", "w").write("docDict="+`docDict`)
More information about the Python-list
mailing list