hsitz/VimOrganizer — Issue #22: Keybinding proposal
Author: paradigm
Created: 2011-11-21 23:15:10+00:00
State: open

From vimorg.txt: "Keybindings are still a moving target. I'm happy to hear from people who think they've found better command bindings."

I put some thought into it, and since the help made you seem so open to ideas I figured I'd pipe up.

The primary difference in philosophy between Emacs and Vim is that Emacs makes heavy use of the modifier keys while Vim determines what keys based on what mode it is in. The default bindings some of the core aspects of VimOrganizer - specifically OrgMoveLevel() and OrgNavigateLevels() - are slightly Emacs with their usage of modifier keys (plus, they don't work on terminals). The solution you've got in place for those who won't or can't use that aren't good for repeated use; hitting ,zu,zu,zu,zu is far more awkward than necessary. Plus, while u/d/l/r make sense in a vacuum for navigating up/down/left/right, they do clash a bit with Vim's h/j/k/l. Having the l key go right in one context and right in another is a bit disorienting.

I propose you create your own mode from which more accessible, simpler keybindings can be used for OrgMoveLevel() and OrgNavigateLevels(). Maybe use o, for example, to enter/start the mode. naturally should be used to return to normal mode. From within org-level-mode (or whatever you would like to call it), h/j/k/l (and the arrow keys without any modifiers) could be used to OrgNavigateLevels() and H/J/K/L could be used to OrgMoveLevel(). Or perhaps f/b/n/p ("forward/backward/next/previous", already used in Vim for other movements) could be used for OrgMoveLevel() to avoid the shift key. Or maybe just have both sets of H/J/K/L and f/b/n/p.

Sadly I'm not sufficiently familiar with orgmode or VimOrganizer to propose what else could be made more accessible with this mode, but there's plenty of keys to spare if you or someone else has other ideas. Anything that would naturally be done in directly before or after OrgMoveLevel()/OrgNavigateLevles() or just be used several times in a row would become much more accessible if made available here.

While this makes sense for doing repeated, sequential actions, it is clearly more typing than your current setup for just a single action in that mode. I figure there should also be a mapping for doing one action in that mode. It could be the z stuff you've got set up; just change u/d/l/r to h/j/k/l and j/k/L/R to f/b/n/p or H/J/K/L. Of course, there's also no reason to remove the bindings you've got for those who do like the arrow keys and modifier keys.

If you don't get to it, but don't hate the idea, I can try and see about coding it up myself and throwing a pull request at you. There's a few more weeks of academics that will be eating my time before winter break, but once mid-december hits I should have the time to dig through your code base and write something up in a similar style which accomplishes this.

That was really the main thing I wanted to say, but a couple of other minor things:

Why is hardcoded in there? I thought the whole idea of the leader key was to allow end-users to pick what to use as a prefix rather than the plugin writers. It wasn't hard to dig into and change to my preferred leader key, but I feel it should be made configurable without having to dig into the source code. Maybe have a check to see if maplocalleader is set, and if not than set it to "," - thus allowing the end user to set it to something else in his/her vimrc easily enough. Or, if you'd prefer, you could just make the script grab the value from a global variable and have the end-user throw let g:org_mode_leader="," in his/her vimrc.

Is Emacs' orgmode picky about whitespace and indentation? If not, I figure << and >> would be natural keybindings for promotion and demotion of headings. Perhaps map them to the appropriate OrgMoveLevel() calls.