在VS代码中创建多个光标的键盘快捷键是什么?


当前回答

https://code.visualstudio.com/Updates

新版本(Visual Studio 0.3.0)支持更多的多光标功能。

Multi-cursor
Here's multi-cursor improvements that we've made.

⌘D selects the word at the cursor, or the next occurrence of the current selection.
⌘K ⌘D moves the last added cursor to next occurrence of the current selection.
The two actions pick up the matchCase and matchWholeWord settings of the find widget.
⌘U undoes the last cursor action, so if you added one cursor too many or made a mistake, press ⌘U to return to the previous cursor state.
Insert cursor above (⌥⌘↑) and insert cursor below (⌥⌘↓) now reveals the last added cursor, making it easier to work with multi-cursors spanning more than one screen height (i.e., working with 300 lines while only 80 fit in the screen).

选择多光标的快捷方式更改为cmd+d(与Sublime Text.lol相同)

我们可以预期,下一个版本支持关于多光标的更方便的功能;)

其他回答

2017年5月自1.13版起使用Ctrl/Cmd+单击添加多个光标

VSCode开发人员引入了一个新的设置editor.multiCursorModifier,以将应用多个光标的修改键更改为在macOS上的Cmd+Click和在Windows和Linux上的Ctrl+Click。这允许来自Sublime Text或Atom等其他编辑器的用户继续使用他们熟悉的键盘修改器。

设置可以设置为:

ctrl/Cmd-映射到Windows上的ctrl和macOS上的Cmd。alt-现有默认alt。

在“选择”菜单中还有一个新的菜单项“使用Ctrl+单击多光标”可快速切换此设置。

“转到定义”和“打开链接”手势也将尊重此设置并进行调整,以使它们不冲突。例如,当设置为ctrl/Cmd时,可以使用ctrl/Cmd+Click添加多个光标,并且可以使用Alt+Click调用打开链接或转到定义。

通过修复问题#2106,现在还可以通过在现有选择的顶部使用相同的手势来移除光标。

Alt+单击。它在Windows中工作。

详细信息:Visual Studio代码文档

在窗口上:如果正在使用vscode,请按住CTRL键并单击如果正在使用visual studio,请按CTRL+Alt+

Alt+Click在OSX中有效。代码版本1.14.2

Ctrl+Alt+⬇ / ⬆ 在当前行的上方和下方添加光标。然而,仍然远不及崇高或括号那么好。在键盘快捷键文件中,我看不到类似于升华中的Ctrl+D。