skip to Main Content

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

2

Answers


  1. 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

    Login or Signup to reply.
  2. 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"
    },
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search