At present, vim-mode's top-level key handler, vc.do_key, passes *all* keys 
back to Leo (k.masterKeyHandler) when focus is not in the body pane.

This is way too confusing: almost all vim bindings will mysteriously appear 
to stop working if, say, focus is in the outline pane.  This is likely the 
cause of the problems that Kent and Steve have reported.  Yes, O and : have 
been working for a long time, but only if focus is in the body pane!

The Aha: many vim bindings have natural analogs in the tree pane!

- h, j, k and l should move around the tree, exactly as Alt-Left, Alt-Down, 
Alt-Up and Alt-Right do.
- a, A, o, O and i might as well move focus back to the body pane, and 
enter insert mode.
- h could do what Ctrl-H does: open the headline for editing.
- : should work anywhere.
- gg and G could move to the first and last nodes of the outline.
- / and ? could begin searches.  They could even confine the search to 
headlines (?!?)

This is a huge step forward.  These extended vim bindings will instantly 
feel natural to any vim user, even reluctant users such as myself.

But another Aha just *might* have me less hostile to vim.  That's the next 
post...

Edward

P.S. It will be dead easy to implement all per-pane vim bindings.  The 
handler for each key will simply do different things depending on vc.w (the 
selected widget). This is about an hour's work.  It will happen today.

P.P.S. Implementing vim bindings is ridiculously simple compared to how Leo 
implements other key bindings: the vim bindings just appear in dispatch 
dicts (Python dictionaries).  I am tempted to use a similar scheme to 
replace @shortcuts nodes in @settings trees.  But that's never going to 
happen: the @shortcuts nodes are much easier for the average person to 
change than writing a plugin that changes some Python dict ;-)

P.P.P.S.  A note about history.  I can understand why people sometimes 
(mistakenly) believe that destiny is at work in our lives.  This Aha came 
at a perfect time.  At any earlier time the issues involved would have been 
too complex to see the solution.

All the recent big successes stem from the decision/Aha to use exiting vim 
bindings as they are, without any modifications to handle Leo's more 
complex environment.  Today's Aha could be called a restatement of that 
earlier Aha, though it feels quite different to me.  In any case, the 
present Aha is firmly grounded in both experience and the actual code base, 
something that was not possible earlier.

EKR

-- 
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 http://groups.google.com/group/leo-editor.
For more options, visit https://groups.google.com/d/optout.

Reply via email to