Home > Blockchain >  How to make backspace behave as backspace in Visual Studio Code
How to make backspace behave as backspace in Visual Studio Code

Time:11-20

In Visual Studio Code I indent using two manually inserted blanks. When I press backspace this deletes two blanks at the same time.

How can I turn off this behavior? I want a backspace to "eat up" exactly ONE blank, especially if the blank is a blank and not a tab.

The question is just the opposite to Deleting tabs when using tabs as spaces.

CodePudding user response:

with extension multi-command you can create a keybinding that does what you want

add to keybindings.json (at the end) this will overrule the default backspace behavior

  {
    "key": "backspace",
    "command": "extension.multiCommand.execute",
    "when": "editorTextFocus && !editorHasSelection",
    "args": { 
        "sequence": [
            "cursorLeft",
            "deleteRight"
        ]
    }
  }

Edit

Added && !editorHasSelection to get the default behavior when there is a selection

  • Related