Leo's second tutorial 
<http://leoeditor.com/tutorial-pim.html#using-abbreviations-and-templates>mentions
 
abbreviations, but doesn't indicate how amazingly powerful they are.

Earlier today I realized that almost all of Leo's commands can be executed 
as abbreviations!

Rev a002317 tweaks the abbreviation code so that commands that set the 
selection range work properly when the abbreviation goes away.  For example:

  e;;={|{x='';c.k.simulateCommand('end-of-line-extend-selection')}|}

defines the e;; abbreviation so it selects from the cursor position (after 
e;; goes away) to the end of the line. Amazing!  Similarly:

ee;;={|{x = '' ; c.k.simulateCommand('end-of-buffer-extend-selection')}|}

Notice:  ee;;  not  E;;  Much easier to type.  Kinda like vim bindings but 
without the need to keep hitting escape ;-)

Abbreviations won't work for commands like sort-line that require an 
existing selection range, but they probably will work for almost all other 
Leo commands.

Abbreviations are full scripting environments.  As such, they are a bit of 
a security risk (but no more than Ctrl-B).  @bool scripting-abbreviations = 
True must be in effect to make this all work.

I don't suppose such abbreviations will supplant the minibuffer, but there 
are many cases in which they would be useful.

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 post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/leo-editor.
For more options, visit https://groups.google.com/d/optout.

Reply via email to