Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use editor.action.joinLines in visual studio code?

As the title says, in visual studio code you can use the editor.action.joinLines to join different lines of text to one single line? Being an editor noob, the question is how? How do I map this command to a key board short cut, or what mouse actions do I need to do after selecting the said text, to get two different lines as one single line? Specifically I am working on Mac OS X.

like image 481
Soham Avatar asked Aug 11 '26 02:08

Soham


1 Answers

To join several lines you have to select them first (you can read more about various ways of selecting text in the vs code documentation) and then invoke the Join Lines command. As a result, all text from the second and next lines will be appended to the end of first lines.

enter image description here

You can invoke the Join Lines command either from the Command Palette by pressing F1 or ++P on macOS and typing Join Lines or by pressing the assigned shortcut - +J

like image 101
Jakub Synowiec Avatar answered Aug 14 '26 14:08

Jakub Synowiec