Open Chillee opened 7 years ago
I think this issue should be solved with efac43773c7f6fbd19bb0500bd9abb737b819ab3 and e6e7d9d8d115cf6996a9c619b2af2e3d4a511fc7.
Basically, how it works now is that the keybindings for package.json are now autogenerated through a script, and we bind every single key (both ctrl keys and shift keys, and it's trivial to add meta/alt keys and so on).
Now, you're able to make VSCodeNeovim pass through these keybindings to VSCode by modifying a setting called vim.ignoreKeys
. This setting looks like
"vim.ignoreKeys": {
"all": [
"<s-esc>",
"<c-`>",
"<c-p>",
"<c-k>"
],
"normal": [],
"insert": [],
"visual": []
}
}
Putting a key in all
causes VSCodeNeovim to pass that key through in all modes. Putting a key in normal/insert/visual
causes VSCodeNeovim to pass through that key in that mode specifically.
So, for example, if you want select all and copy in insert mode, you can just set
"insert": ["<c-c>", "<c-a>"]
, and you'll now be able to do ctrl-a ctrl-c
in insert mode to copy all the text, while still being able to do ctrl-a
to increment a number in normal mode.
If anybody thinks this isn't flexible enough, please suggest improvements! Keep in mind that you'll still be able to bind vim keybindings to call VSCode commands, but that will take your place in your .vimrc.
This seems like good solution.
Also, a million thank you's for working on this.
So I thought about it a little bit more, and while I think that the general method of assigning keybinding control is good, I think the settings themselves should be restructured a bit.
When we support binding alt
or meta
on the neovim side, and even now with shift
, there's a ton of key bindings that we don't want to capture by default. That means that the ignoreKeys array might be huge by default, and if you want to modify it, you'll be copying a pretty huge thing into your settings.json.
I think there should be a better way of doing so.
I think we should rethink keybindings. I've always thought the huge package.json thing where there's a bunch of arbitrary conditions on each key was a bit of a mess.
I haven't really thought this through, but I think that by default, basically every key should be captured. We can then dynamically delegate different keys back to VSCode through some config setting.
IMO, this config setting should have a bunch of the commonly used VSCode ctrl keys let through (
<ctrl-p>
, etc). However, the user should have full control to capture whatever they want. No more "sorry we don't have<ctrl-0>
bound so you can't bind that to a keyboard shortcut" please.