sponsor Vim development Vim logo Vim Book Ad

Pydiction : Tab-complete your Python code

 script karma  Rating 1143/396, Downloaded by 47778    Comments, bugs, improvements  Vim wiki

created by
ryan kulla
 
script type
utility
 
description
Pydiction allows you to Tab-complete Python code in Vim such as keywords, built-ins, standard library, and third-party modules.

For the latest version of Pydiction and full documentation, see: http://rkulla.github.io/pydiction/

It doesn't require installing any dependencies. It simply consists of three files:

    python_pydiction.vim   -- Vim plugin that autocompletes Python code.
    complete-dict              -- Dictionary file of Python keywords, modules, etc.
    pydiction.py                -- Python script to add more words to complete-dict.

The bundled dictionary comes with most terms you will likely need in your day-to-day Python programming, and the included
Python script allows you to easily append new modules to the dictionary. So you don't have to wait around for me to add them.
And you can teach Pydiction to complete your project's own API very quickly. Some third-party libraries already supported are:
`Django` `Flask` `Requests` `Twisted` `Numpy` `Psycopg2` `PyGreSQL` `SQLite3` `MySQLdb` `OpenGL` `Pygame` `wxPython`
`PyGTK` `PyQT4` `OpenID` `lxml` `urwid` `Celery` `Scrapy` and more.
 
install details
If you have Pathogen installed:

    cd ~/.vim/bundle
    git clone https://github.com/rkulla/pydiction.git

or use a plugin manager like Vimogen (https://github.com/rkulla/vimogen) to install and manage Pydiction and all of your plugins.

Otherwise:

    - UNIX/LINUX/OSX: Put python_pydiction.vim in ~/.vim/after/ftplugin/
    (Create this directory if doesn't yet exist. Vim looks there automatically)

    - WINDOWS: Put python_pydiction.vim in C:\vim\vimfiles\ftplugin\
    (Assuming you installed Vim to C:\vim\)

    You may install complete-dict and pydiction.py anywhere (see the Configuration section),
    but only python_pydiction.vim in the ftplugin directory because for .vim files only.

Configuration
==========
In your vimrc file, first add the following line to enable filetype plugins:

    filetype plugin on

then make sure you set g:pydiction_location to the full path of where you installed complete-dict. Ex:

    let g:pydiction_location = '/path/to/complete-dict'

for example, if you used Pathogen to install Pydiction, you would set this to:

    let g:pydiction_location = '/home/user/.vim/bundle/pydiction/complete-dict'

and the dictionary will be available to all of your virtualenv's as well.

You can change the height of the completion menu by setting g:pydiction_menu_height in your vimrc:

    let g:pydiction_menu_height = 3

The default menu height is 8, meaning 8 items at a time will be shown. Some people prefer more or less and you can make it as large as you want since it will automatically know where to position the menu to be visible.

Note: If you were using a version of Pydiction less than 1.0, make sure you delete the old pydiction way of doing things from your vimrc. You should ***NOT*** have this in your vimrc anymore:

        if has("autocmd")
           autocmd FileType python set complete+=k/path/to/pydiction iskeyword+=.,(
        endif " has("autocmd")

If you want to configure other things, such as how to get Pydiction to work with other plugins like `SnipMate` or the color of the menu, see the `Tips` section of the documentation.
 

rate this script Life Changing Helpful Unfulfilling 
script versions (upload new version)

Click on the package to download.

package script version date Vim version user release notes
pydiction-1.2.3.zip 1.2.3 2014-04-29 7.0 ryan kulla Adds scrapy, lxml, urwid and celery. Adds better completion defaults. Removes extra blank lines. Adds better checking for missing attributes.
pydiction-1.2.2.zip 1.2.2 2014-04-04 7.0 ryan kulla Adds latest 2.7 versions of every built-in/stdlib thing and includes Django, Flask, Requests, Psycopg2 and more.  Also adds more completion marker info to the dictionary such as what is a root module, and what version of python and which operating system was use to generated dictionary items.
pydiction-1.2.1.zip 1.2.1 2013-03-03 7.0 ryan kulla Updated file structure for Pathogen and misc. code cleanup
pydiction-1.2.zip 1.2 2009-07-25 7.0 ryan kulla Added "from module" completion, Tab backwards support, and more third party libs.
pydiction-1.1.zip 1.1 2009-07-20 7.0 ryan kulla Added quoted string method completion, ZSI Web Services module completion and fixed a bug with the -v option.
pydiction-1.0.zip 1.0 2009-07-18 7.0 ryan kulla I Rewrote everything. It's now an ftplugin and uses the Tab key for completion. The dictionary generator works much better and you have more options.
pydiction-0.5.tar.gz 0.5 2004-01-19 6.0 ryan kulla Added support for ldap, cleaned up some code and included a gnu license.
pydiction-0.4.tar.gz 0.4 2003-12-16 6.0 ryan kulla support for Numeric and numarray
pydiction-0.3.tar.gz 0.3 2003-12-15 6.0 ryan kulla 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.
pydiction-0.2.tar.gz 0.2 2003-12-06 6.0 ryan kulla Added support for Pygame to pydiction. And im supplying the source code to the pydiction generator so people can extend pydiction so that they can have auto-completion for their own modules/functions/etc
pydiction 0.1 2003-12-06 6.0 ryan kulla Initial upload
ip used for rating: 54.227.41.242

If you have questions or remarks about this site, visit the vimonline development pages. Please use this site responsibly.
Questions about Vim should go to the maillist. Help Bram help Uganda.
   
SourceForge.net Logo