Re: Use the bridge, Luke

2019-06-20 Thread Edward K. Ream


On Thursday, June 20, 2019 at 8:36:34 AM UTC-5, Josef wrote:
>
>
> Support for vim-script may add additional functionality if it would 
> support vim plugins, as there are many available. For me, there are 
> currently just a few reasons for using vim in parallel to Leo: vim starts 
> up fast, has syntax highlighting for just about anything with good print 
> support, comes with every linux version, but the main reason is it is the 
> only editor with some decent support for TaskJuggler. That support is 
> available as plugin, and I guess it is vim-script.
> Just supporting the language, without being able to "just use" plugins 
> will not do much, though. In that case I agree with Terry, that it may be 
> better to use Python.
>

Thanks for this.  I rely on vim users to improve how Leo interacts with vim.

Edward

-- 
You received this message because you are subscribed to the Google Groups 
"leo-editor" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to leo-editor+unsubscr...@googlegroups.com.
To post to this group, send email to leo-editor@googlegroups.com.
Visit this group at https://groups.google.com/group/leo-editor.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/leo-editor/120a75c7-15d0-4859-b4a2-ed49f0bbfb7e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Use the bridge, Luke

2019-06-20 Thread Josef

Support for vim-script may add additional functionality if it would support 
vim plugins, as there are many available. For me, there are currently just 
a few reasons for using vim in parallel to Leo: vim starts up fast, has 
syntax highlighting for just about anything with good print support, comes 
with every linux version, but the main reason is it is the only editor with 
some decent support for TaskJuggler. That support is available as plugin, 
and I guess it is vim-script.
Just supporting the language, without being able to "just use" plugins will 
not do much, though. In that case I agree with Terry, that it may be better 
to use Python.

- Josef

I have just created #1213 
> : support Leo's 
> bridge in vim.  This would be a separate from Leo's vim.py plugin, and 
> might have advantages for some vim users. It would be written in vim 
> script . Anyone interested in this 
> project? I'll be glad to answer any 
>

-- 
You received this message because you are subscribed to the Google Groups 
"leo-editor" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to leo-editor+unsubscr...@googlegroups.com.
To post to this group, send email to leo-editor@googlegroups.com.
Visit this group at https://groups.google.com/group/leo-editor.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/leo-editor/bd30833d-f2be-41fb-ab95-c684f760c493%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Use the bridge, Luke

2019-06-19 Thread Edward K. Ream
On Wed, Jun 19, 2019 at 7:38 AM Terry Brown  wrote:

Ok, this script appends the outline headlines, indented, to the current
> vim buffer:
>

Many thanks for this!  I'll add this to scripts.leo and Leo's bridge
chapter.

Edward

-- 
You received this message because you are subscribed to the Google Groups 
"leo-editor" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to leo-editor+unsubscr...@googlegroups.com.
To post to this group, send email to leo-editor@googlegroups.com.
Visit this group at https://groups.google.com/group/leo-editor.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/leo-editor/CAMF8tS0%3DKin_G8_XZwpEoUh94kjqy0Z87JfCmTTJWw6W5F%2BBbg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Use the bridge, Luke

2019-06-19 Thread Terry Brown
On Wed, 19 Jun 2019 00:52:54 -0500
"Edward K. Ream"  wrote:

> On Tue, Jun 18, 2019 at 6:27 PM Terry Brown 
> wrote:
> 
> Then I'm not sure that there's really anything to do.   Python's
> > well integrated into vim, so you can just use leoBridge as usual.
> 
> 
> Cool.
> 
> > I guess I can do something to verify that, but I can't see why it
> > wouldn't work.
> >
> 
> Please do.  That would be helpful.

Ok, this script appends the outline headlines, indented, to the current
vim buffer:

import leo.core.leoBridge as leoBridge
import vim

controller = leoBridge.controller(
gui='nullGui',
loadPlugins=True,  # True: attempt to load plugins.
readSettings=True,  # True: read standard settings files.
silent=True,  # True: don't print signon messages.
verbose=False,  # True: print informational messages.
)

g = controller.globals()
c = controller.openLeoFile("/home/tbrown/.leo/del.leo")


def dent(node, result, level=0):
result.append('  ' * level + node.h)
for child in node.children:
dent(child, result, level + 1)
return result


result = []
dent(c.hiddenRootNode, result)

vim.current.buffer[-1:] = result


It can be invoked with

:py import leodent

assuming it's in a file leodent.py and on the Python path.

Cheers -Terry

-- 
You received this message because you are subscribed to the Google Groups 
"leo-editor" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to leo-editor+unsubscr...@googlegroups.com.
To post to this group, send email to leo-editor@googlegroups.com.
Visit this group at https://groups.google.com/group/leo-editor.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/leo-editor/20190619073845.72437544%40lakeview.
For more options, visit https://groups.google.com/d/optout.


Re: Use the bridge, Luke

2019-06-18 Thread Edward K. Ream
On Tue, Jun 18, 2019 at 6:27 PM Terry Brown  wrote:

Then I'm not sure that there's really anything to do.   Python's
> well integrated into vim, so you can just use leoBridge as usual.


Cool.

> I guess I can do something to verify that, but I can't see why it
> wouldn't work.
>

Please do.  That would be helpful.

Edward

-- 
You received this message because you are subscribed to the Google Groups 
"leo-editor" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to leo-editor+unsubscr...@googlegroups.com.
To post to this group, send email to leo-editor@googlegroups.com.
Visit this group at https://groups.google.com/group/leo-editor.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/leo-editor/CAMF8tS1WoNrVgv%2BsdUTHz33aPot_mv%2B19GbYoPKGBCuyS9Ksfg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Use the bridge, Luke

2019-06-18 Thread Terry Brown
On Tue, 18 Jun 2019 17:20:37 -0500
"Edward K. Ream"  wrote:

> On Tue, Jun 18, 2019 at 2:22 PM Terry Brown 
> wrote:
> 
> > > Thanks. I didn't know that. In that case the entire vim plugin
> > > would be based on this
> > > . Care to give it
> > > a go?
> >
> > Not without much more specific objectives ;-)
> 
> The objective is simply to be able to access Leo outline from either
> python or vim script.  In python, all that is needed is access to c
> and g.  From c, we get c.p and all the generators.

Then I'm not sure that there's really anything to do.   Python's
well integrated into vim, so you can just use leoBridge as usual.  I
assume - I guess I can do something to verify that, but I can't see why
it wouldn't work.

Cheers -Terry

-- 
You received this message because you are subscribed to the Google Groups 
"leo-editor" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to leo-editor+unsubscr...@googlegroups.com.
To post to this group, send email to leo-editor@googlegroups.com.
Visit this group at https://groups.google.com/group/leo-editor.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/leo-editor/20190618182730.0cbb2997%40lakeview.
For more options, visit https://groups.google.com/d/optout.


Re: Use the bridge, Luke

2019-06-18 Thread Edward K. Ream
On Tue, Jun 18, 2019 at 2:22 PM Terry Brown  wrote:

>
> > Thanks. I didn't know that. In that case the entire vim plugin would
> > be based on this .
> > Care to give it a go?
>
> Not without much more specific objectives ;-)
>

The objective is simply to be able to access Leo outline from either python
or vim script.  In python, all that is needed is access to c and g.  From
c, we get c.p and all the generators.

Edward

-- 
You received this message because you are subscribed to the Google Groups 
"leo-editor" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to leo-editor+unsubscr...@googlegroups.com.
To post to this group, send email to leo-editor@googlegroups.com.
Visit this group at https://groups.google.com/group/leo-editor.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/leo-editor/CAMF8tS1urRoCxmYZmoMw8A2qo7tWnEF3yWFBB-71YR0RBFwihQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Use the bridge, Luke

2019-06-18 Thread Terry Brown
On Tue, 18 Jun 2019 11:31:30 -0700 (PDT)
"Edward K. Ream"  wrote:

> 
> 
> On Tuesday, June 18, 2019 at 12:38:51 PM UTC-5, Terry Brown wrote:
> >
> > A lot of vim plugins are written in Python, so perhaps you could
> > use that instead of vimscript.
> >
> 
> Thanks. I didn't know that. In that case the entire vim plugin would
> be based on this .
> Care to give it a go?

Not without much more specific objectives ;-)

vim doesn't always come with Python support installed, but I'm guessing
more often than not.  Also it's not hard to compile vim from scratch,
so in cases where Python's missing, it's probably not hard to add.

Given that, I don't think any RPC / client-server vimscript <->
leo_bridge_server.py plumbing would be worth the effort, just write the
vim part in Python, and therefore just use leoBridge as usual.

So then what?  vim can use a Leo file as a data structure, but how does
it navigate the Leo file?  vim's https://github.com/scrooloose/nerdtree
and https://github.com/majutsushi/tagbar#screenshots plugins both
implement tree navigation, but I haven't looked at either enough to
know if they can be re-purposed.  I feel that this looks like possibly
low hanging fruit, but would turn into a bigger project.  And there are
other options for editing Leo files.  Leo, for example ;-)

Cheers -Terry

-- 
You received this message because you are subscribed to the Google Groups 
"leo-editor" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to leo-editor+unsubscr...@googlegroups.com.
To post to this group, send email to leo-editor@googlegroups.com.
Visit this group at https://groups.google.com/group/leo-editor.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/leo-editor/20190618142228.0e42abb0%40lakeview.
For more options, visit https://groups.google.com/d/optout.


Re: Use the bridge, Luke

2019-06-18 Thread Edward K. Ream


On Tuesday, June 18, 2019 at 12:38:51 PM UTC-5, Terry Brown wrote:
>
> A lot of vim plugins are written in Python, so perhaps you could use that 
> instead of vimscript.
>

Thanks. I didn't know that. In that case the entire vim plugin would be 
based on this .  Care to 
give it a go?

Edward

-- 
You received this message because you are subscribed to the Google Groups 
"leo-editor" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to leo-editor+unsubscr...@googlegroups.com.
To post to this group, send email to leo-editor@googlegroups.com.
Visit this group at https://groups.google.com/group/leo-editor.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/leo-editor/c79b0504-49f4-413e-99ff-18ee24bac8be%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Use the bridge, Luke

2019-06-18 Thread Terry Brown
A lot of vim plugins are written in Python, so perhaps you could use that
instead of vimscript.

Cheers -Terry

On Tue, Jun 18, 2019 at 12:07 PM Edward K. Ream  wrote:

> Integrating pyzo into Leo fails because pyzo's shell can't control Leo's
> gui.  However, such scripts *could *access the data in Leo outlines using 
> Leo's
> bridge .  That is, Leo's bridge
> supports *restricted Leonine scripts*.  This in no way tempts me to embed
> pyzo's shell, debugger, etc. into Leo ;-)
>
> It is easy to start Leo's bridge from pyzo, or IPython, or any other
> python environment. It's an alternative to leo --ipython, for example.
>
> I have just created #1213
> : support Leo's
> bridge in vim.  This would be a separate from Leo's vim.py plugin, and
> might have advantages for some vim users. It would be written in vim
> script . Anyone interested in this
> project? I'll be glad to answer any questions you may have.
>
> Edward
>
> --
> You received this message because you are subscribed to the Google Groups
> "leo-editor" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to leo-editor+unsubscr...@googlegroups.com.
> To post to this group, send email to leo-editor@googlegroups.com.
> Visit this group at https://groups.google.com/group/leo-editor.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/leo-editor/2a72fe65-4817-40fa-b48a-32902dfce416%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"leo-editor" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to leo-editor+unsubscr...@googlegroups.com.
To post to this group, send email to leo-editor@googlegroups.com.
Visit this group at https://groups.google.com/group/leo-editor.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/leo-editor/CAFPg46RGnJR7qO%2BF0uwtyAWo8n2URR5d_n5s5xphyp0qYGR8ug%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Use the bridge, Luke

2019-06-18 Thread Edward K. Ream
Integrating pyzo into Leo fails because pyzo's shell can't control Leo's 
gui.  However, such scripts *could *access the data in Leo outlines using Leo's 
bridge .  That is, Leo's bridge 
supports *restricted Leonine scripts*.  This in no way tempts me to embed 
pyzo's shell, debugger, etc. into Leo ;-)

It is easy to start Leo's bridge from pyzo, or IPython, or any other python 
environment. It's an alternative to leo --ipython, for example.

I have just created #1213 
: support Leo's 
bridge in vim.  This would be a separate from Leo's vim.py plugin, and 
might have advantages for some vim users. It would be written in vim script 
. Anyone interested in this project? I'll be 
glad to answer any questions you may have.

Edward

-- 
You received this message because you are subscribed to the Google Groups 
"leo-editor" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to leo-editor+unsubscr...@googlegroups.com.
To post to this group, send email to leo-editor@googlegroups.com.
Visit this group at https://groups.google.com/group/leo-editor.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/leo-editor/2a72fe65-4817-40fa-b48a-32902dfce416%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.