I would like to add a key binding for inserting a line break in the editor (textInputFocus
). Normally the Return key does this (VS Code calls the key Enter
). Which command in VS Code can I use?
There is lineBreakInsert
but this does not behave exactly the same as Enter
normally does - it inserts a line break but keeps the cursor in the same position.
CodePudding user response:
Currently this is my workaround, but it's not a perfect solution:
I installed multi-command and added this binding (in keybindings.json
):
{
"key": "ctrl o",
"command": "extension.multiCommand.execute",
"args": {
"sequence": [
"lineBreakInsert",
"cursorDown",
"cursorHome"
]
},
"when": "textInputFocus"
}
CodePudding user response:
Is this what you are looking for:
{
"key": "ctrl o",
"command": "type",
"args": {
"text": "\n"
},
"when": "textInputFocus"
}