Skip to content

Commit 7a17174

Browse files
rkullavim-scripts
authored andcommitted
Version 0.3
This version allows you to supply multiple module names to pydiction.py and it will auto-append them to the pydiction file. The included pydiction file now contains support for wxPython and Twisted.
1 parent fc60bd1 commit 7a17174

File tree

3 files changed

+145799
-97
lines changed

3 files changed

+145799
-97
lines changed

README.orig

Lines changed: 74 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,65 @@
1-
pydiction README
2-
-----------------
1+
Pydiction
2+
Version: 0.3
3+
Author: Ryan (gt3) Kulla. ambiod@sbcglobal.net
4+
Date: Dec 2003
35

4-
CONTENTS
5-
--------
66

7-
1) About Pydiction
8-
2) How to add your own modules to the pydiction dictionary file
7+
Description: pydiction is a special dictionary file of Python modules for use with vim's completion feature.
8+
Pydiction.py is a program that generates the pydiction file and you can use it to add your
9+
project's own modules to it.
910

10-
===========================================================================================
11+
When you supply a module name to pydiction.py it will generate the modules contents in 2 forms.
12+
The first form will be a list of the modules contents with the module name prefixed such as:
1113

12-
ABOUT PYDICTION
13-
---------------
14-
About Pydiction
15-
Author: Ryan Kulla
14+
module.function1(
15+
module.function1(
16+
module.nonfunction1
17+
module.nonfunction2
18+
...
1619

17-
Description: pydiction is a special dictionary file of common Python modules/methods/keywords for use with
18-
vim's auto-completion feature.
20+
The first format is useful when you "import module" and are required to type the module prefix.
21+
22+
The second form will be a list of just the module's method names without the module prefix:
23+
24+
function1(
25+
function2(
26+
nonfunction1
27+
nonfunction2
28+
...
29+
30+
The second form is useful when you "from module import functions".
1931

20-
Usage:
21-
Put the following 2 lines in your vimrc file:
2232

23-
set complete+=k
24-
set dictionary+=/path/to/pydiction
33+
"pydiction.py" Usage:
2534

26-
Now you can simply hit Ctrl-n or Cntrl-p to autocomplete Python module/keyword names.
35+
pydiction.py module1 module2..
36+
37+
Example: The following will append all the time and math module's attributes to the file "pydiction" with
38+
and without the "time." and "math." prefixes:
39+
40+
pydiction.py time math
41+
42+
If you supply the -v option to pydiction.py it will dump the output to your screen instead of appending it
43+
to the pydiction file:
44+
45+
pydiction.py -v time math
46+
47+
48+
"pydiction dictionary file" Usage:
49+
Put the following lines in your vimrc file:
50+
51+
set complete+=k
52+
set isk+=.
53+
set isk+=(
54+
set dictionary+=/path/to/pydiction
55+
56+
Now you can simply hit Control-n (n=next) or Control-p (p=previous) to complete Python code.
57+
(type ":help completion" in vim for more details)
2758

2859
Example:
2960
Typing the following (in insert mode):
3061

31-
os.lis
62+
os.lis<Ctrl-n>
3263

3364
will expand to:
3465

@@ -37,22 +68,33 @@ will expand to:
3768
You can also leave out the module.
3869
Example:
3970

40-
lis
71+
lis<Ctrl-n>
4172

4273
will expand to:
4374

4475
listdir(
4576

77+
More examples:
78+
79+
la<Ctrl-n> = lambda
80+
wx<Ctrl-n> = wxPython
81+
twisted.pr<Ctrl-n> = twisted.protocols (Keep hitting Ctrl-n to see twisted.protocols.*)
82+
__b<Ctrl-n> = __builtin__ (Ctrl-n again = __builtins__)
83+
sys.getr<Ctrl-n> = sys.getrecursionlimit(
84+
sy<Ctrl-n> = sys.getrecursionlimit( (Vim remembers you've just used it)
85+
4686
If there are multiple entries for an abbreviation, you'll be givin a list of names to choose from.
4787

48-
Supported Python Modules:
49-
__builtin__, __main__, __future__, os, os.walk, sys, datetime, time, locale, atexit, readline, rlcompleter,
50-
types, UserDict, UserList, UserString, operator, inspect, traceback, linecache, pickle, cPickle, copy_reg,
51-
shelve, copy, marshal, warnings, imp, pkgutil, code, codeop, pprint, repr, new, site, user, string, re,
52-
struct, difflib, fpformat, StringIO, cStringIO, textwrap, codecs, encodings, unicodedata, stringprep, pydoc,
53-
doctest, unittest, test, math, cmath, random, whrandom, bisect, heapq, array, sets, itertools, ConfigParser,
54-
fileinput, xreadlines, cmd, shlex, dircache, stat, statcache, statvfs, filecmp, popen2, sched, mutex, getpass,
55-
curses, getopt, optparse, tempfile, errno, glob, fnmatch, shutil, gettext, logging, signal, socket, select,
88+
89+
Currently Supported Python Modules:
90+
__builtin__, __main__, __future__, os, os.walk, sys, datetime, time, locale,
91+
atexit, readline, rlcompleter, types, UserDict, UserList, UserString, operator, inspect, traceback,
92+
linecache, pickle, cPickle, copy_reg, shelve, copy, marshal, warnings, imp, pkgutil, code, codeop,
93+
pprint, repr, new, site, user, string, re, struct, difflib, fpformat, StringIO, cStringIO, textwrap,
94+
codecs, encodings, unicodedata, stringprep, pydoc, doctest, unittest, test, math, cmath, random,
95+
whrandom, bisect, heapq, array, sets, itertools, ConfigParser, fileinput, xreadlines, cmd, shlex,
96+
dircache, stat, statcache, statvfs, filecmp, popen2, sched, mutex, getpass, curses, getopt,
97+
optparse, tempfile, errno, glob, fnmatch, shutil, gettext, logging, signal, socket, select,
5698
thread, threading, dummy_thread, dummy_threading, Queue, mmap, anydbm, dbhash, whichdb, bsddb,
5799
dumbdbm, zlib, gzip, bz2, zipfile, tarfile, posix, pwd, grp, crypt, dl, gdbm, termios, tty, pty,
58100
fcntl, pipes, resource, syslog, commands, pdb, profile, hotshot, timeit, webbrowser, cgi, cgitb,
@@ -65,35 +107,17 @@ xml.dom.pulldom, xml.sax, xml.sax.handler, xml.sax.saxutils, xml.sax.xmlreader,
65107
aifc, sunau, wave, chunk, colorsys, rgbimg, imghdr, sndhdr, hmac, md5, sha, rotor, Tkinter, Tix,
66108
ScrolledText, turtle, rexec, Bastion, parser, symbol, token, keyword, tokenize, tabnanny, pyclbr,
67109
py_compile, compileall, dis, distutils, compiler, compiler.ast, compiler.visitor, msvcrt, _winreg,
68-
winsound, pygame, pygame.rect, pygame.surface, pygame.cdrom, pygame.display, pygame.draw, pygame.event,
69-
pygame.font, pygame.image, pygame.joystick, pygame.key, pygame.mixer, pygame.mixer.music, pygame.mouse,
70-
pygame.movie, pygame.sndarray, pygame.surfarray, pygame.time, pygame.transform, pygame.color,
71-
pygame.cursors, pygame.sprite
110+
winsound, pygame, wxPython, twisted
72111

73-
Supported Python Keywords:
112+
Currently Supported Keywords:
74113
and del for is raise
75114
assert elif from lambda return
76115
break else global not try
77116
class except if or while
78117
continue exec import pass yield
79118
def finally in print
80119

81-
========================================================================================================
82-
83-
84-
HOW TO ADD YOUR OWN MODULES TO THE PYDICTION DICTIONARY FILE
85-
------------------------------------------------------------
86-
87-
pydiction.py is used for creating a dictionary of Python's module/method names for vim's completion feature.
88-
89-
If you're working on a big project you might want to add your projects own module/method/etc names to the
90-
pydiction file so you can auto-complete those names as well.
91-
92-
Usage:
93-
94-
pydiction.py <module-name> >>pydiction
120+
---
121+
Other modules will be supported in future versions
95122

96-
Example: The following will append all the time module's methods to the file "pydiction" with
97-
and without the "time." prefix:
98123

99-
pydiction.py time >>pydiction

0 commit comments

Comments
 (0)