如何在Visual Studio Code中复制一行或所选内容? [英] How do I duplicate a line or selection within Visual Studio Code?
问题描述
如何使用Microsoft的Visual Studio代码复制一行代码,然后上下移动它? (类似于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+Alt+Down and Shift+Alt+Up
Mac:
Shift + 选项 + 向下和 Shift + 选项 上
Shift+Option+Down and Shift+OptionUp
Linux:
Ctrl + Shift + Alt + Down 和 Ctrl + Shift + Alt + 上
Ctrl+Shift+Alt+Down and Ctrl+Shift+Alt+Up
(对于Linux,可能需要使用numpad Down 和 Up )
(Might need to use numpad Down and Up for Linux)
此外,命令editor.action.moveLinesUpAction
和editor.action.moveLinesDownAction
是用于移动行的命令,它们绑定到 Alt + Down 和 Alt 在Windows和Mac上为+ 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屋!