vimways.org icon indicating copy to clipboard operation
vimways.org copied to clipboard

[WIP] Preliminary empty draft about the python interface

Open bstaletic opened this issue 6 years ago • 2 comments

The plan is do go in details about the python interface. This would include:

  • The basic inline python and calling python functions from the vim command line.
  • Checking that vim has been compiled with python support and correctly* invoking python from inside vim.
  • Becoming friends with import vim - an in depth showcase of what vim exposes through this embedded python module and how to work around limitations when encountered.
  • Approach to writing an abstraction over the "raw" vim module, because conversions from a vim type to a python type can have surprising results.
    • There should be a special part about handling unicode, because python2/python3 differences here make passing a vim 'šт®ïñг' to python an easy foot-gun.

* Maybe also mention that no matter what, some non-working python enabled vim installations exist? For example, the default vim on the latest macOS has broken python support, causing python to raise MemoryError at best and make vim segfault at worst.

NOTE: As you can see, this is an empty PR. I'll be able to work on this after the 15th of July, but @romainl asked me to post an empty PR anyway. For reference, the discussion is here.

bstaletic avatar Jun 21 '19 09:06 bstaletic

Looks interesting. I don't know too much about the Python interface, so I look forward to reading the final result!

One suggestion, that I didn't see in your outline ... it's been my experience using Python plugins that others have written is that they tend to be fairly slow compared to pure Vimscript. Were you planning to discuss how to avoid that situation?

djmoch avatar Jun 21 '19 12:06 djmoch

@bstaletic Is it safe to assume that you won't be able to finish this article?

romainl avatar Jan 02 '20 11:01 romainl