Vscode json custom setting cursor shortcut keys to move up, down, left, and right

1. Open the configuration file

  The path is as shown in the figure below: File -> Preferences -> Keyboard Shortcuts -> Open Keyboard Shortcut JSON (step 3 file icon in the upper right corner).
insert image description here

Second, copy the configuration file

  Just copy the following document into the opened document, such as custom:

  • Delete everything to the left of the cursor:Ctrl + Backspace
  • Delete everything to the right of the cursor:Alt + Backspace
// Place your key bindings in this file to override the defaultsauto[]
 
[
    {
      "key": "alt+i",
      "command": "cursorUp",
      "when": "textInputFocus"
    },
    {
      "key": "up",
      "command": "cursorUp",
      "when": "textInputFocus"
    },
    {
      "key": "alt+i",
      "command": "selectPrevSuggestion",
      "when": "suggestWidgetMultipleSuggestions && suggestWidgetVisible && textInputFocus"
    },
    {
      "key": "up",
      "command": "selectPrevSuggestion",
      "when": "suggestWidgetMultipleSuggestions && suggestWidgetVisible && textInputFocus"
    },
 
    {
      "key": "alt+k",
      "command": "cursorDown",
      "when": "textInputFocus"
    },
    {
      "key": "down",
      "command": "cursorDown",
      "when": "textInputFocus"
    },
    {
      "key": "alt+k",
      "command": "selectNextSuggestion",
      "when": "suggestWidgetMultipleSuggestions && suggestWidgetVisible && textInputFocus"
    },
    {
      "key": "down",
      "command": "-selectNextSuggestion",
      "when": "suggestWidgetMultipleSuggestions && suggestWidgetVisible && textInputFocus"
    },
 
    {
      "key": "alt+l",
      "command": "cursorRight",
      "when": "textInputFocus"
    },
    {
      "key": "right",
      "command": "cursorRight",
      "when": "textInputFocus"
    },
 
    {
      "key": "alt+j",
      "command": "cursorLeft",
      "when": "textInputFocus"
    },
    {
      "key": "left",
      "command": "cursorLeft",
      "when": "textInputFocus"
    },
 
    {
      "key": "alt+o",
      "command": "cursorEnd",
      "when": "textInputFocus"
    },
    {
      "key": "end",
      "command": "cursorEnd",
      "when": "textInputFocus"
    },
 
    {
      "key": "alt+u",
      "command": "cursorHome",
      "when": "textInputFocus"
    },
    {
      "key": "home",
      "command": "cursorHome",
      "when": "textInputFocus"
    }
    {
      "key": "alt+backspace",
      "command": "deleteAllRight",
      "when": "textInputFocus"
    }
    {
      "key": "ctrl+backspace",
      "command": "deleteAllLeft",
      "when": "textInputFocus"
    }
 
]
  
  

Guess you like

Origin blog.csdn.net/qq_38429958/article/details/126841403