You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

124 lines
5.0 KiB
Plaintext

Pydiction
Version: 0.5
Author: Ryan (gt3) Kulla. ambiod@sbcglobal.net
Date: Jan 2004
Description: pydiction is a special dictionary file of Python modules for use with vim's completion feature.
Pydiction.py is a program that generates the pydiction file and you can use it to add your
project's own modules to it.
When you supply a module name to pydiction.py it will generate the modules contents in 2 forms.
The first form will be a list of the modules contents with the module name prefixed such as:
module.function1(
module.function1(
module.nonfunction1
module.nonfunction2
...
The first format is useful when you "import module" and are required to type the module prefix.
The second form will be a list of just the module's method names without the module prefix:
function1(
function2(
nonfunction1
nonfunction2
...
The second form is useful when you "from module import functions".
"pydiction.py" Usage:
pydiction.py module1 module2..
Example: The following will append all the time and math module's attributes to the file "pydiction" with
and without the "time." and "math." prefixes:
pydiction.py time math
If you supply the -v option to pydiction.py it will dump the output to your screen instead of appending it
to the pydiction file:
pydiction.py -v time math
"pydiction dictionary file" Usage:
Put the following lines in your vimrc file:
if has("autocmd")
autocmd FileType python set complete+=k/path/to/pydiction iskeyword+=.,(
endif " has("autocmd")
Now you can simply hit Control-n (n=next) or Control-p (p=previous) to complete Python code.
(type ":help completion" in vim for more details)
Example:
Typing the following (in insert mode):
os.lis<Ctrl-n>
will expand to:
os.listdir(
You can also leave out the module.
Example:
lis<Ctrl-n>
will expand to:
listdir(
More examples:
la<Ctrl-n> = lambda
wx<Ctrl-n> = wxPython
twisted.pr<Ctrl-n> = twisted.protocols (Keep hitting Ctrl-n to see twisted.protocols.*)
__b<Ctrl-n> = __builtin__ (Ctrl-n again = __builtins__)
sys.getr<Ctrl-n> = sys.getrecursionlimit(
sy<Ctrl-n> = sys.getrecursionlimit( (Vim remembers you've just used it)
If there are multiple entries for an abbreviation, you'll be givin a list of names to choose from.
Currently Supported Python Modules:
__builtin__, __main__, __future__, os, os.walk, sys, datetime, time, locale,
atexit, readline, rlcompleter, types, UserDict, UserList, UserString, operator, inspect, traceback,
linecache, pickle, cPickle, copy_reg, shelve, copy, marshal, warnings, imp, pkgutil, code, codeop,
pprint, repr, new, site, user, string, re, struct, difflib, fpformat, StringIO, cStringIO, textwrap,
codecs, encodings, unicodedata, stringprep, pydoc, doctest, unittest, test, math, cmath, random,
whrandom, bisect, heapq, array, sets, itertools, ConfigParser, fileinput, xreadlines, cmd, shlex,
dircache, stat, statcache, statvfs, filecmp, popen2, sched, mutex, getpass, curses, getopt,
optparse, tempfile, errno, glob, fnmatch, shutil, gettext, logging, signal, socket, select,
thread, threading, dummy_thread, dummy_threading, Queue, mmap, anydbm, dbhash, whichdb, bsddb,
dumbdbm, zlib, gzip, bz2, zipfile, tarfile, posix, pwd, grp, crypt, dl, gdbm, termios, tty, pty,
fcntl, pipes, resource, syslog, commands, pdb, profile, hotshot, timeit, webbrowser, cgi, cgitb,
urllib, urllib2, httplib, ftplib, gopherlib, poplib, imaplib, nntplib, smtplib, telnetlib, urlparse,
SocketServer, BaseHTTPServer, SimpleHTTPServer, CGIHTTPServer, Cookie, xmlrpclib, SimpleXMLRPCServer,
DocXMLRPCServer, asyncore, asynchat, formatter, email, mailcap, mailbox, mhlib, mimetools, mimetypes,
MimeWriter, mimify, multifile, rfc822, base64, binascii, binhex, quopri, uu, xdrlib, netrc, robotparser,
csv, HTMLParser, sgmllib, htmllib, htmlentitydefs, xml.parsers.expat, xml.dom, xml.dom.minidom,
xml.dom.pulldom, xml.sax, xml.sax.handler, xml.sax.saxutils, xml.sax.xmlreader, xmllib, audioop, imageop,
aifc, sunau, wave, chunk, colorsys, rgbimg, imghdr, sndhdr, hmac, md5, sha, rotor, Tkinter, Tix,
ScrolledText, turtle, rexec, Bastion, parser, symbol, token, keyword, tokenize, tabnanny, pyclbr,
py_compile, compileall, dis, distutils, compiler, compiler.ast, compiler.visitor, msvcrt, _winreg,
winsound, pygame, wxPython, twisted, Numeric, numarray, ldap
Currently Supported Keywords:
and del for is raise
assert elif from lambda return
break else global not try
class except if or while
continue exec import pass yield
def finally in print
---
Other modules will be supported in future versions