有可能像Sublime Text一样启用多行编辑吗?

例如,按Ctrl键可以放置额外的游标插入符号,并且可以同时在文档中的多个位置进行写入/删除操作。


当前回答

框中选择

Windows: shift + alt +鼠标左键

macOS: shift + option +单击

这与在回答“Visual Studio Code是否有框选择/多行编辑?”中提到的内容相反。

其他回答

我认为这取决于你的Visual Studio Code版本。

我的是Linux版本Visual Studio Code 1.7.2。

{ "key": "ctrl+shift+up",         "command": "editor.action.insertCursorAbove",
                                     "when": "editorTextFocus" },
{ "key": "shift+alt+up",          "command": "editor.action.insertCursorAbove",
                                     "when": "editorTextFocus" },
{ "key": "ctrl+shift+down",       "command": "editor.action.insertCursorBelow",
                                     "when": "editorTextFocus" },
{ "key": "shift+alt+down",        "command": "editor.action.insertCursorBelow",
                                     "when": "editorTextFocus" }

关键是所有机器的快捷方式都不一样,所以您应该检查您的配置。进入菜单:

菜单文件→首选项→键盘快捷键

搜索editor.action.insertCursorAbove和editor.action.insertCursorBelow并查看当前配置。如果它们与操作系统的快捷键冲突,您可以更改它们。

1.43版(2020年2月)

你现在可以切换列选择模式,改变鼠标手势和方向键,通过:

菜单栏>选择>选择列的方式 Ctrl+Shift+P (Show All Commands) >切换列选择模式 绑定命令"editor.action.toggleColumnSelection"的键

注:激活后状态栏有“列选择”面板,按下可再次禁用。

根据VS Code 1.55.2版本(2021)下的用户>常用部分,有一个选项作为多游标修饰符。见下图。

对于多光标默认键是alt,如果你想它可以更改为Ctrl。 此外,对于合适的位置,可以按住鼠标中键向下移动。

好吧,我用Alt键选择我想编辑的行,就是这样。 或者,如果要编辑的东西在上面或下面,我们可以使用Ctrl + Alt + UP/DOWN箭头。

我正在使用vscodevim扩展,所以我不确定这是否是一个常见的问题。但是,我有问题,Ctrl + Alt + UpArrow翻转我的屏幕上下颠倒。

看看Visual Studio Code Basics(我不知道他们在最近的更新中是否改变了这一点),它说要使用:

ctrl+alt+shift +(上下)