I'm using Vim with VSCode.
I'm trying to remap ctrl+e
to got to the end of the line when in insert mode. Here is what I wrote in my settings.json
:
"vim.insertModeKeyBindingsNonRecursive": [{ "before": ["<C-o>", "$"], "after": ["<C-e>"] }]
Unfortunately, this somehow doesn't work. How can I remap this?
Edit: Based on the answers, I also tried
"vim.insertModeKeyBindingsNonRecursive": [ { "before": ["<C-e>"], "commands": { "command": "cursorLineEnd" } } ]
and
"vim.insertModeKeyBindingsNonRecursive": [{ "before": ["<C-e>"], "commands": "cursorLineEnd" }]
which also both didn't work.
Try using the commands
option instead:
"vim.insertModeKeyBindingsNonRecursive": [{
"before":[
"<C-e>"
],
"after":[],
"commands":[
{
"command":"cursorEnd",
"args":[]
}
]
}]
Update: I have attempted several <C-...>
combinations and after a couple of hours of fiddling I've come to the conclusion that some Ctrl
bindings simply do not work. I've tried multiple variations to no avail, and any other key combination seems to work flawlessly, see this for example:
"vim.insertModeKeyBindingsNonRecursive": [
{
"before": [
"j",
"k"
],
"commands": [
"cursorLineEnd",
]
}
]
My suggestion for you now is to avoid Ctrl
remappings, use <leader>
instead. You can also properly organize these findings and open a new issue on GitHub.
P.S
You can check command names in File -> Preferences -> Keyboard Shortcuts:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With