Might also be advantageous to add up and down for new users
Hell... we could make this a setting too?
ts
else if (key === "<C-n>" || key === "<C-j>" || key === "<down>") {
UI.Actions.nextMenuItem()
} else if (key === "<C-p>" || key === "<C-k>" || key === "<up>") {
UI.Actions.previousMenuItem()
}
Also c-w to delete prev word, c-u to delete entire line etc...
We're working on a way currently to make keybindings much easier, but it's going to take a while.
Bear with us :)
Definitely! There are a few open issues in terms of key bindings:
But the case where the keybindings go through Oni (and don't round-trip through Neovim) is actually the simplest.
Exposing this as a setting would be a good solution in the interim while that's being worked out. Perhaps something like keybindings.nextMenuItem and keybindings.previousMenuItem would be reasonable for now? I definitely see these hardcoded keybindings as being an annoyance... so having a short-term solution that we can iterate on seems reasonable to me.
Just to give some ideas of what I'm thinking in terms of input, longer-term, is something a bit more general, like for this case:
Oni.map("<C-n>", "menu.nextItem")
But also be able to map to arbitrary functions:
Oni.map("<C-Left>", () => Oni.windows.focusLeft())
And access functions exposed by plugins:
Oni.map("<C-Enter>", () => Oni.plugins.orgModeForOni.toggleTodo())
And give some helpers to make doing transformations easier, something like:
(this is a pointless example,
Oni.map("<C-J>", Oni.helpers.transformLine((line) => line.toLowerCase())
A few other considerations I'm thinking about:
config.jsPerformance is critical, and I want to spend some time looking at how Emacs/VSCode/Atom/Sublime handle key bindings. In my opinion the Vim-way of handling keybindings is confusing... it took me longer than I would like to admit to understand noremap vs nmap 馃槃 Another goal is to make it easy to iterate - create very light-weight plugins in my config.js that I can extract out as plugins to share with others.
Sorry for the wall of text, just wanted to share what I was thinking at the moment
@extropy I will definitely research this after working on the quickopen issues
@extr0py
An idea I had instead of putting it in the oni config, what if we having a keybindings.js and we can have a menu link to open it as well?
I will test in a bit and see how it flows with our code.
But reason being is for my suggestion, my init.vim has all my vim stuff, and then I source plug.vim for all my plugins, I don't like them being all in the same file, because it gets messy.
Key bindings don't feel like a config thing to me, it feels like something separate.
Sure, keybindings.js sounds like a good place for it!
Now that #633 is in, this should be enabled by adding:
// menu bindings...
oni.input.bind("<c-j>", "menu.next")
oni.input.bind("<c-k>", "menu.previous")
// completion too
oni.input.bind("<c-j>", "completion.next")
oni.input.bind("<c-k>", "completion.previous")
To the activate method of your config.js. I'll close this for now, but let me know if it doesn't work for you @cyansprite
Most helpful comment
@extropy I will definitely research this after working on the quickopen issues