ANN: Leo 3.11b1 outlining editor
Andrea Galimberti
andrea_galimberti at tin.it
Thu Feb 20 03:36:50 EST 2003
Edward K. Ream wrote:
>
> The Open With command was new in 3.10 and has been improved in 3.11.
> Plugins are new in 3.11, though underlying code has been around for a while.
>
About Leo and VIM "integrated" vesion, I wrote a plugin that opens a Leo
node content in VIM. Here is the source:
---------------------- plugin ---------------------------
"""vim handler"""
from leoPlugins import *
from leoGlobals import *
def open_in_vim (tag,keywords):
if top():
top().frame.OnOpenWith(("os.system", "/usr/local/bin/vim --remote ", None))
if 1: # Register the handlers...
registerHandler("iconclick2", open_in_vim)
es("...vim")
---------------------- end --------------------------------
To create the plugin:
- create a node in the plugin section with header: @file plugins/mod_vim.py
- paste in its body the source above
- comment out the @ignore in "Convenience routines for hooks" to enable
the creation of the plugin files
- comment out the @ignore in "Official plugins"
- save LeoPy.leo
- tangle leoConfig.leo to create leoConfig.txt
- change use_plugins = 1 in leoConfig.txt
To use it:
- start VIM as server: vim --servername "VIM"
- note: the name of the server *must* be "VIM"
- then, when you single-click in Leo on the icon of a node that node
will be opened in the VIM instance you started as server. And Leo will
sincronize back the modified contents when you save the file in VIM.
BTW: I would be glad if Edward includes my plugin in the "Contribution
from users" section.
I noted that plugins are found only if the current working directory is
leo's directory: this is because Leo does an os.getcwd(). Is this right
or am I missing something? I think it would be more appropriate to
search the plugins directory in the path where leo.py is: something like
os.path.join(os.path.dirname(sys.argv[0]), "plugins").
\bye, Andrea
More information about the Python-list
mailing list