visual-studio-code - 如何在 Visual Studio Code 中创建多个光标

标签 visual-studio-code

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

最佳答案

Alt 并单击。这适用于 Windows 和 Linux*,并且也应该适用于 Mac。

Visual Studio Code 0.2 中现在提供了更多多光标功能:

Multi cursor improvements
Ctrl+D (Cmd+D on Mac) selects next occurrence of word under cursor or of the current selection
Ctrl+K Ctrl+D moves last added cursor to next occurrence of word under cursor or of the current selection
The commands use matchCase by default. If the find widget is open, then the find widget settings (matchCase / matchWholeWord) will be used for determining the next occurrence
Ctrl+U (Cmd+U on Mac) undoes the last cursor action, so if you added a cursor too many or made a mistake, you can press Ctrl+U (Cmd+U on Mac) to go back to the previous cursor state. Adding cursor up or down (Ctrl+Alt+Up / Ctrl+Alt+Down) (Cmd+Alt+Up / Cmd+Alt+Down on Mac) now reveals the last added cursor to make it easier to work with multiple cursors on more than 1 viewport height at a time (i.e. select 300 lines and only 80 fit in the viewport).

This makes it a lot easier to introduce multiple cursors

* Linux 拖动窗口冲突:

Some distros (e.g. Ubuntu) assign window dragging to Alt+LeftMouse, which will conflict with VSCode.

So, recent versions of VSCode let you toggle between Alt+LeftMouse and Ctrl+LeftMouse under the Selection menu, as detailed in another answer.

Alternately, you could change your OS key bindings using gsettings as mentioned in another answer.

关于visual-studio-code - 如何在 Visual Studio Code 中创建多个光标,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29953479/

相关文章:

visual-studio-code - 如何使用旧版本的 Visual Studio Code?

visual-studio-code - 如何在通过 Microsoft Store 安装 vs code 而不是下载 .exe 时添加 "Open with vs code"?

node.js - vscode 无法启动 Node 应用程序

visual-studio-code - 有没有什么方法可以直观地更改 VS Code 中特定编辑器的表示?

visual-studio-code - 使用 Visual Studio Code 对齐多行编辑光标

visual-studio-code - 如何在 VSCode 调试器中禁用 "just my code"设置?

typescript - Visual Studio代码无法正确踩入TypeScript代码

visual-studio-code - 如何在 Windows 上启用 synthwave 84 中的 NEON ?

visual-studio-code - 寻找类似于 VS Code Remote SSH Extension 的 PyCharm Remote Dev 体验

ftp - 如何在 VSCode 中使用 ftp.simple