[英]How to join multiple lines into one line with VS Code?
In Sublime Text 3, having multiple cursors on several lines and joining them with CMD+J results in a single line: 在Sublime Text 3中,在多行上具有多个光标并将它们与CMD + J结合在一起将导致一行:
However, the same operation in VS Code (CTRL+J), results in half the number of initial lines (in this case 3 / 2 = 1.5 ≈ 2): 但是,VS代码(CTRL + J)中的相同操作导致初始行数减少一半(在这种情况下,3/2 = 1.5≈2):
Is there a way to join all lines into one line in VS Code? 有没有一种方法可以在VS Code中将所有行合并为一行?
There is a command editor.action.joinLines
which doesn't have a default keybinding. 有一个命令
editor.action.joinLines
没有默认的键绑定。 When you trigger it, you get the result you want. 触发它时,您将获得所需的结果。
{
"key": "ctrl+alt+j", // or your keybinding
"command": "editor.action.joinLines"
}
No need for a cursor on the multiple lines, just select the lines you want to join and trigger the command (either with some keybinding or in the Command Palette). 无需在多行上使用光标,只需选择要加入的行并触发命令即可(使用某些键盘绑定或在“命令面板”中)。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.