1

Is there any way in Visual Studio Code to prevent "over-selection" when using Shift + Alt + RightArrow combo?

E.g. if I'm at the end of line 4 below and I hit that key combo, VS Code selects up until the end of bar which is never what I want and means I always have to unselect the last word:

selecting in VS Code

In JetBrain's WebStorm for example, it only selects up to start of bar which is much more useful:

enter image description here

1 Answer 1

1

Ok, got it. This is controlled by the "alt+right" and "shift+alt+right" settings in the keybindings.json file.

By default they map to cursorWordEndRight and cursorWordEndRightSelect respectively. You can map them to cursorWordStartRight and cursorWordStartRightSelect by adding the following entries in your keybindings.json overrides file:

[
  { "key": "alt+right",
    "command": "cursorWordStartRight",
    "when": "editorTextFocus"
  },
  { "key": "shift+alt+right",
    "command": "cursorWordStartRightSelect",
    "when": "editorTextFocus"
  },
]

Tip: you can get to the keybindings.json file that by going to edit Keyboard Shortcuts. There's a link to edit the file at the top.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.