如何在Visual Studio Code中复制一行或所选内容? [英] How do I duplicate a line or selection within Visual Studio Code?

查看:467
本文介绍了如何在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.copyLinesDownActioneditor.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.moveLinesUpActioneditor.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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆