Yes, it can be hard to find out how to do things you want in Leo.  The good 
news is that you can do most anything.  Remember to undo/redo operations 
that change a node or the tree - my title-case script shows how to do that 
for node content.

Leo's code base is in the PyLeoRef.leo outline, as I imagine you already 
know.  IMHO, the best way to find code that might be related to what you 
want is the Nav tab, along with tab completion of minibuffer commands.  
When you type (or paste) into the search box in the Nav tab, it shows you 
node headlines that match.  After you hit ENTER, it also shows you body 
matches.

For example, you write that you want to duplicate a line.  So you have to 
select or at least find a line to copy.  I remembered that there is a 
command to move a line up.  I typed "move" into the minibuffer and then TAB 
to get a list of all matching command.  There it was - "move-lines-up".  I 
copied that and pasted it into the search box in the Nav tab.  This showed 
a match for "@cmd('move-lines-up')".  Clicking on that took me to where the 
command is defined.  Right there it shows how to get the selection range, 
and how to get the line from the selection.

The other excellent feature is the ability to CTRL-click on a function or 
method call and (usually) get taken to its definition.

Forgive me if you already know these things. They have been really helpful 
for me.  And, as Edward would advise, judicious use of clones can be very 
helpful.  Also, you might want to check out the Freewin plugin - it opens a 
stand-alone window that shows a single node in a basic editor, which you 
can keep open alongside Leo's window for reference while you navigate to 
some other node.  That's probably new since you were last working with Leo.

On Tuesday, January 10, 2023 at 4:11:17 PM UTC-5 Kevin Henderson wrote:

> This is great timing Thomas, thank you! 
> I've been away from Leo for a while, but making another attempt to get 
> back into it.
>
> I've had a _heck_ of time figuring out how to do what showed, in my case I 
> wanted a 'duplicate-line' command. 
> It really is tremendously difficult to figure out what to do or where to 
> start. 
>
> a couple of observations:
> - what got me the furthest (but not all the way there) is/was the 
> `scripts.leo` file (i.e. the 'Text' section).
> - most of the scripts & guides seem to be around working with nodes (which 
> seems easier) rather than body text. 
> - the body text seems very challenging/manual to work with, perhaps some 
> utility functions would make this easier
>   - e.g. for my duplicate line command, i'll have repeat most of Thomas's 
> code above, there isn't a simple utility function
>   - there are already commands such as 'extend-to-line'/extendToLine, but 
> do I have access to these or do i have to reproduce them?
> - it would be nice to group these docs & content by context, e.g. the 
> guides with the examples
>
> Anyway, it's good to say hello again, glad to see things are still 
> plugging.
>
> Cheers & Happy 2023,
> Kevin
>
>
> On Wednesday, January 4, 2023 at 1:27:17 PM UTC-5 [email protected] wrote:
>
>> Let's add the scripting-miscellany link to Leo's Help menu.
>>
>> On Wednesday, January 4, 2023 at 11:32:09 AM UTC-5 Edward K. Ream wrote:
>>
>>> On Wednesday, January 4, 2023 at 10:18:53 AM UTC-6 Edward K. Ream wrote:
>>>
>>> > I've just added this entry 
>>> <http://leoeditor.com/scripting-miscellany.html#keeping-clean-files-up-to-date>
>>>  
>>> (online and in devel).
>>>
>>> And I've just updated this page 
>>> <http://leoeditor.com/directives.html#clean-path> in Leo's Reference 
>>> Guide.
>>>
>>> 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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/leo-editor/22093325-71e3-49d1-a966-e13eee6d8803n%40googlegroups.com.

Reply via email to