visual-studio-codekeyboard-shortcuts

Unable to add user shortcut


After creating my first shortcut, which worked well, I tried to make a new one to move the cursor to the end of the line, but here I faced a problem: the shortcut didn't work.

// Place your key bindings in this file to override the defaults
[
  {
    "key": "ctrl+n",
    "command": "explorer.newFile"
  },
  {
    "key": "shift+space",
    "command": "editor.action.insertCursorAtEndOfEachLineSelected",
    "when": "editorTextFocus"
  },
]

I checked if the key combination was already used, but it wasn't. I also tried other combinations, but the problem was still consistent.

enter image description here


Solution

  • I think the right command is "cursorEnd" because "cursorEndSelect" will select the text from the current position to the end of the line. However, I think you want to move the cursor to the end of the line, so you need to use the command I mentioned before.