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

查看:145
本文介绍了如何在 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.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+DownShift+Alt+向上

苹果机:

Shift+Option+DownShift+Option向上

Linux:

Ctrl+Shift+Alt+向下Ctrl+Shift+Alt+向上

(Linux 可能需要使用 numpad DownUp)

(Might need to use numpad Down and Up for Linux)

此外,命令 editor.action.moveLinesUpActioneditor.action.moveLinesDownAction 是用于移动行的命令,它们绑定到 Alt+DownAlt+Up(在 Windows 和 Mac 上)和 Ctrl+DownCtrl+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天全站免登陆