1
- pydiction README
2
- -----------------
1
+ Pydiction
2
+ Version: 0.3
3
+ Author: Ryan (gt3) Kulla. ambiod@sbcglobal.net
4
+ Date: Dec 2003
3
5
4
- CONTENTS
5
- --------
6
6
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.
9
10
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:
11
13
12
- ABOUT PYDICTION
13
- ---------------
14
- About Pydiction
15
- Author: Ryan Kulla
14
+ module.function1(
15
+ module.function1(
16
+ module.nonfunction1
17
+ module.nonfunction2
18
+ ...
16
19
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".
19
31
20
- Usage:
21
- Put the following 2 lines in your vimrc file:
22
32
23
- set complete+=k
24
- set dictionary+=/path/to/pydiction
33
+ "pydiction.py" Usage:
25
34
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)
27
58
28
59
Example:
29
60
Typing the following (in insert mode):
30
61
31
- os.lis
62
+ os.lis<Ctrl-n>
32
63
33
64
will expand to:
34
65
@@ -37,22 +68,33 @@ will expand to:
37
68
You can also leave out the module.
38
69
Example:
39
70
40
- lis
71
+ lis<Ctrl-n>
41
72
42
73
will expand to:
43
74
44
75
listdir(
45
76
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
+
46
86
If there are multiple entries for an abbreviation, you'll be givin a list of names to choose from.
47
87
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,
56
98
thread, threading, dummy_thread, dummy_threading, Queue, mmap, anydbm, dbhash, whichdb, bsddb,
57
99
dumbdbm, zlib, gzip, bz2, zipfile, tarfile, posix, pwd, grp, crypt, dl, gdbm, termios, tty, pty,
58
100
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,
65
107
aifc, sunau, wave, chunk, colorsys, rgbimg, imghdr, sndhdr, hmac, md5, sha, rotor, Tkinter, Tix,
66
108
ScrolledText, turtle, rexec, Bastion, parser, symbol, token, keyword, tokenize, tabnanny, pyclbr,
67
109
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
72
111
73
- Supported Python Keywords:
112
+ Currently Supported Keywords:
74
113
and del for is raise
75
114
assert elif from lambda return
76
115
break else global not try
77
116
class except if or while
78
117
continue exec import pass yield
79
118
def finally in print
80
119
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
95
122
96
- Example: The following will append all the time module's methods to the file "pydiction" with
97
- and without the "time." prefix:
98
123
99
- pydiction.py time >>pydiction
0 commit comments