1

From the position in my screenshot, if I do ctrl+left, the cursor will skip the . symbol. Same for ={, it will skip = symbol. How can I prevent this behavior in VS Code, and not skip that? In JetBrains products, it works like that, and it's really bothers me in VS Code.

cursor position example

starball
  • 20,030
  • 7
  • 43
  • 238

2 Answers2

0

I believe you want the cursorWordStartLeft and cursorWordStartRight bindings to be bound. You can set them to whatever you want, but you probably want them to be the same as the cursorWordLeft and cursorWordRight. Of course you also probably want to unbind the other controls too. You also probably want the same when condition which is textInputFocus && !accessibilityModeEnabled:

cursor word start left and right bindings to enable

After setting this bindings, the cursor behaves more like how you want:

gif showing changed cursor beahvior

Timothy G.
  • 6,335
  • 7
  • 30
  • 46
  • Yes, more, but not exactly as i want to. Well, i guess VSCode just haven't this behavior yet, and not sure it'll ever have. Thanks for your answer anyways. – Satont Worldwide May 21 '23 at 11:48
0

There are the following keybinding commands that you can experiment with using, and tuning to your taste: cursorWordStartLeft, cursorWordStartRight, cursorWordEndLeft, and cursorWordEndRight.

There are also things like cursorWordAccessibilityLeft (seems to skip more), cursorWordPartLeft (Ex. stops at things like capitals in camel-case words), and cursorWordPartStartLeft that you can experiment with.

For example here's how you can unbind the default cursorWordLeft and cursorWordRight from ctrl+left and ctrl+right, and instead bind them to cursorWordStartLeft and cursorWordEndRight:

// unbind defaults:
{
    "key": "ctrl+left",
    "command": "-cursorWordLeft",
    "when": "textInputFocus"
},
{
    "key": "ctrl+right",
    "command": "-cursorWordRight",
    "when": "textInputFocus"
},
// bind customizations:
{
    "key": "ctrl+left",
    "command": "cursorWordStartLeft",
    "when": "textInputFocus"
},
{
    "key": "ctrl+right",
    "command": "cursorWordEndRight",
    "when": "textInputFocus"
},
starball
  • 20,030
  • 7
  • 43
  • 238