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

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


当前回答

我认为这取决于你的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并查看当前配置。如果它们与操作系统的快捷键冲突,您可以更改它们。

其他回答

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

(没有鼠标)对于macOS,我发现这是非常快的!

CMD + f搜索要更改的(单词)。 选项+输入选择你搜索的所有单词。

只要更新第一个单词,它就会更新所有选定的单词。

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

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

ctrl+alt+shift +(上下)

1.43版(2020年2月)

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

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

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

在Visual Studio Code中,只需按Alt键并将光标放在编辑位置(你想编辑的地方),然后右键单击选择。