Search code examples
visual-studio-codekeyboard-shortcuts

VSCode jump to the middle of current line


There are many keyboard shortcuts and edit options in Visual Studio Code, I can move cursor: by character, by word, to beginning/end of line. But, if I'm editing a long line of text, how to faster jump to the middle of this line ?

Found similar question here, but for vim users - Visually select to the middle of line

Probably, it's possible to implement this option (jump to middle) with Vim extension. If so, then how to do it ?

Is there a way to make such behaviour natively without any extensions ?


Solution

  • Actually, this is built-in to vscode, using the cursorMove command. Set up this keybinding in your keybindings.json:

    {
      "key": "alt+c",
      "command": "cursorMove",
      "args": {
        "to": "wrappedLineColumnCenter",
        "select": true  // default is false
      }
    }