Home>

I want to set a command that inserts a blank line in command mode in Vim plug-in of Visual Studio Code.
Could you tell me how to write it?

Also, on this site , use space + enter key I am doing
As myself, Skype and LINE will be line break processing with Shift + Enter key, so
I am trying to set blank line insertion processing with Shift + Enter key. Isn't it strange?

Applicable source code

This site describes how to set commands
I don't know how to write it.

I want to set Shift + Enter so that the O + Esc command is executed.

{
    "vim.normalModeKeyBindingsNonRecursive": [
        {
            "before": [
                "u"
            ],
            "after": [],
            "commands": [
                {
                    "command": "undo"
                }
            ]
        },
        {
            "before": [
                "<C-r>"
            ],
            "after": [],
            "commands": [
                {
                    "command": "redo"
                }
            ]
        }
    ]
}
Append

Tell me a note.

How to edit keybindings.json.

Click [keybindings.json] in [File] menu->[Basic Settings]->[Keyboard Shortcuts].
If I want to insert a line break before, insertLineBefore instead of insertLineAfter.

[
  {
    "key": "shift + enter",
    "command": "editor.action.insertLineBefore",
    "when": "editorTextFocus&&! editorReadonly"
  },
]
  • Answer # 1

    Hello.
    Command mode or normal mode.
    Trying to map Shift-Enter didn't work, so
    There is a way to put VSCode's standard key binding inkeybindings.jsonfor quick implementation.

    {
        "key": "shift + enter",
        "command": "editor.action.insertLineAfter",
        "when": "editorTextFocus&&! editorReadonly"
    },

    How about this?


    Although VSCodeVim can actually map like this ...

    // settings.json
    "vim.normalModeKeyBindingsNonRecursive": [
        {"before": ["<Enter>"], "commands": ["editor.action.insertLineAfter"]}, // If the Enter alone could be mapped, S-Enter could not be done (why?)
    ],