monome / maiden

web based editor and repl for norns
GNU General Public License v3.0
47 stars 34 forks source link

rationalize / prune and document editor keybindings #61

Open pq opened 6 years ago

pq commented 6 years ago

The Ace editor ships with A LOT of keybindings on by default [1]. A few conflict with browser ones which some folks find annoying and in general the sheer number is potentially overwhelming -- and makes assigning sensible ones for the things we actually care about hard.

To remedy, I propose we:

Thoughts?

@ngwese @jlmitch5 @tehn

[1] A quick tally (var key in this.editor.keyBinding.$defaultHandler.commandKeyBinding ...) gives us ~120 (including the 3 we've added). Sheesh!

EDIT: running through them, some of the bindings aren't commands exactly, things like HOME and DELETE, so it's not as bad as all that. Still, it's a lot more than folks know or care to know about.

pq commented 6 years ago

Oh, and as we head into supporting editing modes like vim and emacs, whatever we do should minimally play nice; ideally make those modes better!

jlmitch5 commented 6 years ago

If we can do this in a way that allows us to pull in ace like we currently are, and then somehow omit the keybindings we don’t want, I think that would be a maintainable way we can do this.

What I think may be potentially difficult is forming and maintaining our own version of ace.

If the reason we are specifically omitting certain bindings is because they can conflict with browser bindings, then they should be omitted across all modes.

pq commented 6 years ago

Agreed. We can remove bindings programmatically (editor.keyBinding.removeKeyboardHandler(...)) so no need for any heroics. Modes are a real wrinkle and I need to do some investigating. Getting modes right in general will be key to making the editor useable for opinionated typists which I'm guessing a bunch of folks out there are!

jlmitch5 commented 6 years ago

@pq there will be an editor.json file as part of the pr for #10

I'm thinking that we could add an omitBindings: object or array to that the editor can use. that way, users can edit it if they want.

pq commented 6 years ago

@jlmitch5 : that's awesome! i'd want to stabilize a bindings "API" if we went this route and would want to do a little thinking before making it available but it's a great idea if this is something that folks ask for. (ideally though we get this close enough to just right that they won't need to!)

pq commented 6 years ago

@jlmitch5 : what's the format for editor.json ? late to the party i realize, but did you consider extending something pre-existing like editorconfig? that might be nice if folks want to edit the same directory in another editor. i don't have strong feelings; just curious!