如何在 Visual Studio Code 中复制行或选择? [英] How do I duplicate a line or selection within Visual Studio Code?
问题描述
使用 Microsoft 的 Visual Studio Code,如何复制一行代码然后上下移动?(类似于 Sublime 的 cmd+shift+d 行为)
Using Microsoft's Visual Studio Code, how do I duplicate a line of code and then move it up and down? (Similar to Sublime's cmd+shift+d behaviour)
这是我经常使用的一项功能,如果没有它,我正在努力使用 Visual Studio Code.
It's a feature that I use constantly, and am struggling using Visual Studio Code without it.
推荐答案
您正在寻找的命令是 editor.action.copyLinesDownAction
和 editor.action.copyLinesUpAction
.
The commands your are looking for are editor.action.copyLinesDownAction
and editor.action.copyLinesUpAction
.
您可以通过选择来查看关联的键绑定:文件 > 首选项 > 键盘快捷键
You can see the associated keybindings by picking: File > Preferences > Keyboard Shortcuts
Windows:
Shift+Alt+Down 和 Shift+Alt+向上
苹果机:
Shift+Option+Down 和 Shift+Option向上
Linux:
Ctrl+Shift+Alt+向下 和 Ctrl+Shift+Alt+向上
(Linux 可能需要使用 numpad Down 和 Up)
(Might need to use numpad Down and Up for Linux)
此外,命令 editor.action.moveLinesUpAction
和 editor.action.moveLinesDownAction
是用于移动行的命令,它们绑定到 Alt+Down 和 Alt+Up(在 Windows 和 Mac 上)和 Ctrl+Down 和Ctrl+Up 在 Linux 上.
Furthermore, commands editor.action.moveLinesUpAction
and editor.action.moveLinesDownAction
are the ones to move lines and they are bound to Alt+Down and Alt+Up on Windows and Mac and Ctrl+Down and Ctrl+Up on Linux.
这篇关于如何在 Visual Studio Code 中复制行或选择?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!