[英]Select multiple lines with cursors at each line start
I want to select multiple lines and put a cursor at the beginning of each line.我想选择多行并将光标放在每行的开头。 Sublime Text can do this with Ctrl - Shift - L select multiple lines Sublime Text 可以使用Ctrl - Shift - L选择多行
ctrl + shift + L and then put cursor at beginning of each line ctrl + shift + L 然后将光标放在每行的开头
Press Crtl + Shift + Alt + Arrow up/down to select multiple lines in Visual Studio Code.按Crtl + Shift + Alt +向上/向下箭头以在 Visual Studio Code 中选择多行。 Note that the selected lines will be in one column (if possible).请注意,选定的行将在一列中(如果可能)。
You can also mark some lines and then do this combination and you have all selected lines included.您还可以标记一些行,然后执行此组合,您将包含所有选定的行。
Moreover you can press and hold Alt and click the lines you need.此外,您可以按住Alt并单击所需的行。 This way you can select multiple lines that are not neighbours or in the same column.这样,您可以选择不相邻或不在同一列中的多条线。
To do exactly what Ctrl - Shift - L does in Sublime Text, you must do:要完全执行Ctrl - Shift - L在 Sublime Text 中所做的事情,您必须执行以下操作:
On Windows:在 Windows 上:
Select the lines.选择线条。
Alt - Shift - I (will add multiple cursors) Alt - Shift - I (将添加多个光标)
Shift - Home (will go at the beginning of each line and be selected) Shift - Home (将在每行的开头并被选中)
On Mac :在 Mac 上:
Select the lines.选择线条。
alt - shift - I (will add multiple cursors) alt - shift - I (将添加多个游标)
cmd - shift - ← (will go at the beginning of each line and be selected) cmd - shift - ← (将在每行的开头并被选中)
More information in this answer .此答案中的更多信息。
Ctrl - Shift - Alt - Arrow down/up will put a cursor at the beginning of the following/preceding lines Ctrl - Shift - Alt -向下/向上箭头将光标置于以下/前一行的开头
Ctrl - I will select those lines with the cursor at the beginning of each line. Ctrl -我将在每行的开头使用光标选择这些行。
NOTE : On my vscode the cursors look like they might be shifted down one line but they actually are not - the are in the right place.注意:在我的 vscode 上,光标看起来可能会向下移动一行,但实际上并非如此——它们位于正确的位置。 If you start typing, it works but you have to hit Enter when you are done to get back separate lines.如果您开始输入,它可以工作,但您必须在完成后按 Enter才能返回单独的行。 It is a little quirky but works as you would expect.这有点古怪,但可以按您的预期工作。
EDIT (using a hint from @Maxime's answer)编辑(使用来自@Maxime 答案的提示)
island
not a lowercase L) Alt - Shift - I :将光标放在每一行的末尾,但未选择文本(I 在island
中不是小写 L)Important: read the NOTE above.重要提示:阅读上述注意事项。
--------------------- v1.43 see How to put the cursor at the end of all selected lines in Visual Studio Code? --------------------- v1.43请参阅如何将光标置于 Visual Studio Code 中所有选定行的末尾? with column selection mode it is easy to put the cursor at the beginning or end of lines selected by dragging.使用列选择模式,很容易将光标放在通过拖动选择的行的开头或结尾。
You can hold alt and click the places you need with the mouse.您可以按住alt并用鼠标单击所需的位置。 This way you can select rows
that aren't related, like row 10,15,18.这样您就可以选择不相关的rows
,例如第 10、15、18 行。 Also you can select at different places in the same row.您也可以在同一行的不同位置进行选择。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.