Visual Studio 按键:交换行

发布于 2024-10-31 17:29:04 字数 308 浏览 6 评论 0原文

Visual Studio中有没有类似Eclipse的Alt + /的按键?

例如:

int x = 0; // Cursor is anywhere on this line.
int y = 1;

按下 Alt + Down,然后:

int y = 1;
int x = 0; // Cursor is anywhere on this line.

Is there a keystroke in visual studio similar to Eclipse's Alt + /?

For example:

int x = 0; // Cursor is anywhere on this line.
int y = 1;

and Alt + Down were pressed, then:

int y = 1;
int x = 0; // Cursor is anywhere on this line.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(5

熟人话多 2024-11-07 17:29:04

VS 2013 及更高版本:

Alt + (Edit.MoveSelectedLinesUp)

Alt + (Edit.MoveSelectedLinesDown)


VS 2012:

Shift+Alt+ T
(Edit.LineTranspose)

但这仅在当前行和下一行之间交换(仅向下移动)。

VS 2012 不支持宏,但有生产力电动工具 2012 扩展,添加(除了一些其他不错的功能之外)使用 Alt + Alt + 向上或向下移动行的命令↓


VS 2010 及更早版本:

行转置可以工作(Shift+Alt+ T),但仍然无法向上移动。

您可以为这些命令编写一个宏,我认为这个问题可能对您有帮助:Visual Studio:向上/向下移动行并移动的热键最近的变化

VS 2013 and later:

Alt + (Edit.MoveSelectedLinesUp)

Alt + (Edit.MoveSelectedLinesDown)


VS 2012:

Shift+Alt+ T
(Edit.LineTranspose)

but this only swaps between the current and the next line (move down only).

VS 2012 does not support macros but there is the Productivity Power Tools 2012 extension that adds (besides some other nice features) commands to move a line up or down with Alt + and Alt + .


VS 2010 and earlier:

Line transpose works (Shift+Alt+ T) but still no move up.

You could write a macro for those commands, I think this question may help you: Visual Studio: hotkeys to move line up/down and move through recent changes

时光瘦了 2024-11-07 17:29:04

从 Visual Studio 2013 开始,您只需使用 Alt + /

As of Visual Studio 2013, you can simply use Alt + /

近箐 2024-11-07 17:29:04

对于Mac,它是:选项 + /

For Mac, It is: option + /

忘羡 2024-11-07 17:29:04

作为替代解决方案,您可以编写 Visual Studio 扩展来为您执行此操作。扩展是用您最喜欢的 .NET 语言编写的。

有关详细信息,请参阅有关创建 Visual Studio 扩展的 MSDN 文章。

As an alternative solution, you could write a Visual Studio Extension to do this for you. Extensions are written in your favorite .NET language.

Refer to the MSDN article on creating Visual Studio Extensions for more information.

酷到爆炸 2024-11-07 17:29:04

Windows 中的 Alt + 向上/向下箭头。
请注意,此快捷方式尚未在 Windows 的官方 Visual Studio Code 键盘快捷方式中列出 (https://code.visualstudio.com/shortcuts/keyboard-shortcuts-windows.pdf

Alt + Up/Down arrow in Windows.
Be aware that this shortcut is not listed in the official Visual Studio Code keyboard shorcut for Windows yet (https://code.visualstudio.com/shortcuts/keyboard-shortcuts-windows.pdf)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文