vim & python

François Pinard pinard at iro.umontreal.ca
Thu Mar 4 23:44:52 EST 2004


[sb]

> > > [...] but what about vim scripting with python? I can not find
> > > *anything* about it (no docs, books or tutorials)

> > Just do:
> >    :h python

> Thanks, but that is more like a very abbreviated tutorial.

I did not read it as a tutorial, but as a concise and useful reference.

> Where can I can the real documentation?  It seems like the python
> built into vim is different. [...] I want the real documentation for
> the "vim" module accessible from vim. What classes, functions, values
> are defined there, etc

The real documentation is the usual Python documentation, all that we
use outside Vim, plus the result of `:h python' for classes, functions
and values specific to Vim.  There is not much of them, but there is no
need for much either; what is provided is surely sufficient for a great
lot of applications.

> For example, doing

> :py import sys
> :py dir(sys)

> produces no output. Odd. Same with

> :py import vim
> :py dir(vim)

The same would not give you output in Python either (unless you run
Python in an interactive read-eval-print loop, like when you call Python
without arguments from an interactive shell).  However, you may use:

    :py print dir(sys)
    ...
    :py print dir(vim)

You have to ask for printing, if you want printing.

-- 
François Pinard   http://www.iro.umontreal.ca/~pinard




More information about the Python-list mailing list