Fixes #117
Hopefully the commit messages are mostly explanatory:
(first commit is just a fix for emacs being neglected)
docs: correct base keymap to emacs and add missing emacs to list
If you remove the base keymap from your user settings and restart, emacs
will be selected, not VSCode.
Add "minimal" base keymap
This allows users to enable vim/helix keybinds without inheriting a full
set of keybinds from another editor. It only includes a small set of
bindings that are normally provided by another editor's binds and are
missing from the vim/helix bindings, and that are not vim/helix-specific,
meaning they don't care about editor mode and don't use vim/helix-style
keyboard shortcuts. (Missing vim/helix-specific keys will be added to
their bindings directly.)
Add missing vim/helix keybindings for use with Minimal base
Some basic editing functionality (enter for newline, backspace, etc.)
was provided by other editors' keymaps, but if you use the Minimal base
keymap, some basic functionality that depends on vim/helix modes or
binding styles was still missing, and is provided here.
This result differs slightly from the discussion in #117 because of the need for some keys to check vim mode, which doesn't belong in a base keymap. Also, I named it "Minimal (for vim/helix)" in user-facing places because a general "Minimal" base keymap (that would also work for non-vim/helix users) would require a lot more bindings, and then it would no longer serve the purpose for vim/helix users. I don't think such a keymap is necessarily a bad idea, just that it didn't solve this issue. (It'd be a big effort to make a Gram keymap from scratch, but maybe it's worthwhile someday.)
Some thoughts on the implementation:
- I was happy that I only needed to add this many bindings to get a usable environment without the bindings from another editor, but of course it's not perfect. Plenty of things still require mouse interaction, and it wasn't my intent to fix that, but as a long-time vim user, I think this feels pretty close to what I'd expect from a vim mode in an IDE. I may have more ideas for improvements over time!
- The only "flights of fancy" (bindings not from vim) are the ones to toggle the docks, but I think there's in the right spirit and don't conflict with existing Gram keys. (The ctrl-w b and r bindings do conflict with vim hotkeys for window management, but Gram has different ways of doing those things.) I think there's definitely room to add more Gram-specific bindings similar to this.
- The onboarding screen needed a button for the Minimal base keymap, so I chose the basic "code" icon for that. The existing rows were full, so I added a third row. The column counts have to match, and the type of each column has to match, meaning the second and third buttons had to have icons, so I just made a blank icon. Those buttons do nothing, of course.