Add cursor shortcut in VSCode
Add a shortcut to move the cursor to the end of the line in the VSCode terminal
In the VSCode terminal, whenever we want to go to the start of a long command, we only need to press Ctrl+A. However, there is no default shortcut to jump to the end of the line, so we have to add one.
Here’s how to add the shortcut:
- Open the keyboard shortcuts JSON file in VSCode:
- Press
Ctrl+Shift+P, then runPreferences: Open Keyboard Shortcuts (JSON). - (
Ctrl+KthenCtrl+Sopens the graphical editor instead.)
- Press
- Add this entry (I’m using
Ctrl+E, but you can use any key you want):1 2 3 4 5 6 7 8
{ "key": "ctrl+e", "command": "workbench.action.terminal.sendSequence", "when": "terminalFocus", "args": { "text": "\u0005" } }
\u0005 is the Ctrl+E control character, which the shell interprets as “move to end of line”.
This post is licensed under CC BY 4.0 by the author.