Closed suhr closed 4 years ago
All Vim emulators are based on the type
hook of VS Code. That basically sends the extension a single ASCII character that was pressed. Since Shift+Enter produces the same ASCII code as Enter alone \n
, there is no way to bind it to a different command.
It is possible, however, to bind Shift+Enter using the standard VS Code key bindings (Ctrl+K, Ctrl+S). But then you can only bind to a single command, not to a sequence as in ModalEdit.
I'll keep this issue open, since I've been thinking of improvement to add a new command to ModalEdit that would have the same effect as typing a command sequence in normal mode. That could be useful also in other use cases, but would also allow you to define a binding in ModalEdit and "call" it from VS codes standard keybindings.
Added new command modaledit.typeNormalKeys
to version 1.3. It allows you to run normal mode commands through key bindings. Assuming that you have bound \n
to lineBreakInsert
command, and I
to a command that switches to insert mode, you can combine and bind them to Shift+Enter by adding this section to your VS Code keybindings.json
:
{
"key": "shift+enter",
"command": "modaledit.typeNormalKeys",
"when": "modaledit.normal",
"args": {
"keys": "\nI"
}
,
It would be nice to be able to bind Shit+Enter.