What's the keyboard shortcut for joining two lines in VS Code?
If the cursor is anywhere in the first line of
f(foo, bar)
then when I hit the shortcut, I want to get
f(foo, bar)
When you want to merge two lines into one, position the cursor anywhere on the first line, and press J to join the two lines. J joins the line the cursor is on with the line below. Repeat the last command ( J ) with the . to join the next line with the current line.
Joins consecutive lines. The J (join) command joins a specified number of lines together as one line. Number of consecutive lines, starting with the current line, to be joined to the current line.
“how to repeat lines in vscode *” Code Answer On Windows: Shift + Alt + Up/Down. On Mac: Shift + Option + Up/Down. On Ubuntu: Ctrl + Shift + Alt + Up/Down.
Visual Studio Code now comes with a default key binding for joining lines, Ctrl + J.
You can find all keyboard shortcuts under Preferences > Open Keyboard Shortcuts
.
You can overwrite it using the UI or by providing a different key combination for the command editor.action.joinLines
in keybindings.json
.
Press F1, and type Join Lines. By default there is no key bindings to it yet, but you can easily set it under 'Preferences > Keyboard Shortcuts', then search for Join Lines and set a shortcut.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With