在VS代码中创建多个光标的键盘快捷键是什么?
当前回答
你想要的东西没有约束。
唯一接近的是Ctrl+F2,它将一次选择所有选项。
您可以通过以下操作将其绑定到Ctrl+D:
单击“文件”>“首选项”>“键盘快捷键”您应该会看到一个窗格,其中包含当前绑定,并且右侧有一个自定义绑定列表在当前绑定中,搜索Ctrl+F2并复制整行并将其粘贴到右侧窗格中。您可能需要删除末尾的逗号,然后将Ctrl+F2更改为Ctrl+D,然后保存文件。
它应该看起来像这样:
// Place your key bindings in this file to overwrite the defaults
[
{ "key": "ctrl+d", "command": "editor.action.changeAll",
"when": "editorTextFocus" }
]
其他回答
在Ubuntu上,为了启用多光标单击,您需要首先通过运行下面的命令重新分配Alt+click。这是因为默认情况下,Ubuntu使用快捷方式本身并具有优先权。
> gsettings set org.gnome.desktop.wm.preferences mouse-button-modifier "<Super>"
尝试Ctrl+Alt+Shift+⬇ / ⬆, 不使用鼠标,或按住“alt”并单击所需的所有行。
注意:已在Windows上测试。
对于xfce用户,只需转到“设置”>“窗口管理器调整”>“可访问性”,即可将用于抓取和移动窗口的键更改为“超级”,如下图所示。
现在你可以用super代替alt.Wallah!!通过按住alt键并单击来创建多个光标。
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相同)
我们可以预期,下一个版本支持关于多光标的更方便的功能;)
Cmd+Option+Shift⬇ / ⬆ 在最新的VSCode 1.29.1和最新的OSX High Sierra 10.13.6,Macbook Pro上为我工作。
这将在屏幕上向上/向下添加一条垂直线,就像Sublime文本中的Option+单击/垂直拖动一样。
要在文件中的任意位置添加多个光标,包括同一行上的多个,请执行Cmd(或Option)+单击本视频中所示的任意位置。您也可以搜索重复多次的文本(Cmd+F),然后按Option+Retur在每个单词的末尾添加光标。
推荐文章
- 如何禁用预览文件与点击在vs代码?
- Visual Studio代码更改文件资源管理器托盘的字体大小?
- 如何防止Visual Studio Code总是重新打开以前的文件或文件夹?
- VSCode单引号到双引号自动替换
- 如何删除Visual Studio代码中的重复行?
- 如何设置每个文件类型的标签大小?
- 我如何添加环境变量启动。VSCode中的json
- 如何格式化Visual Studio Code项目中的所有文件?
- Pylint在Visual Studio代码中“未解决的导入”错误
- 如何在VS Code中默认打开文本换行
- 在Visual Studio代码中更改突出显示文本的颜色
- Visual studio代码-键盘快捷键-全部展开/折叠
- Visual Studio Code无法检测已安装的Git
- 禁用Visual Studio代码中的工具提示提示
- Visual Studio Code -将空格转换为制表符