Search code examples
visual-studio-codekeyboard-shortcuts

what is the keyboard shortcut to reach end of line of multicursor in ubuntu?


Ubuntu 24.04 VS Code

Commit: f1e16e1e6214d7c44d078b1f0607b2388f29d729
Date: 2024-07-09T22:08:12.169Z
Electron: 29.4.0
ElectronBuildId: 9728852
Chromium: 122.0.6261.156
Node.js: 20.9.0
V8: 12.2.281.27-electron.0
OS: Linux x64 6.8.0-38-generic

I have multi cursor lines selected and want to reach end of each line, how can we move using keyboard in vs code? showing <kbd>Ctrl</kbd> + <kbd>Shift</kbd> + I <kbd>I</kbd> in keyboard shortcut but it doesnt work at all

using Ctrl + Right/Left Arrow move word by word whil my each line are not in similar length


Solution

  • You can do this by using the cursorEnd command. Its default keyboard shortcut is assigned to the End key so you can use the End key to reach the end of each selected line.

    If you would like to configure its keyboard shortcut, you can set a keyboard shortcut combination for this command in two ways:

    First way: Set it from the Keyboard Shortcuts panel:

    1. Open the Keyboard Shortcuts panel from File > Preferences > Keyboard Shortcuts or the Manage icon at the left bottom or just use Ctrl + K + S keyboard combination
    2. Search the cursorEnd command in the search bar, and you will see this panel. If you would like to change it, click on this line and set a keyboard shortcut. Then, you can reach the end of the line for the selected lines by using this keyboard shortcut

    Second way: Set it from the keybindings.json file:

    1. Open the Keyboard Shortcuts panel from File > Preferences > Keyboard Shortcuts or the Manage icon at the left bottom or just use Ctrl + K + S keyboard combination
    2. Open the keybindings.json file from the right top corner file icon (Displays this overlay on hover: Open Keyboard Shortcuts) in the Keyboard Shortcuts panel.
    3. Then, you can add this command there by using these configurations:
    {
       "key": "Write your shortcut combination here",
       "command": "cursorEnd"
    }
    

    Hope, it's clear and helpful