在Visual Studio 2012中向上/向下移动行快捷方式 [英] Move line Up/Down shortcut in Visual Studio 2012

查看:735
本文介绍了在Visual Studio 2012中向上/向下移动行快捷方式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在VS2010中,我有一个快捷键设置了 Alt + Up/Down 来上下移动代码行,就像我以前在Java中的Eclipse中一样天.

In VS2010 I had a shortcut set up Alt+Up/Down to move lines of code up or down, just like I used to have in Eclipse in my Java days.

现在,由于VS2012中不提供Power Tools和宏(这是我在VS2010中设置此快捷方式的方式),如何使它起作用?

Now since Power Tools and macros (which is how I set up this shortcut in VS2010) are not available in VS2012, how do I get this to work?

我已经看到有人提到Resharper可以做到这一点,但是出于对火和水的热爱,我在可以做到这一点的命令列表中找不到命令名称. 我已经尝试过ReSharper_MoveUp/MoveDown,但不会向上/向下移动行:

I've seen somebody mentioned that Resharper can do this, but for the love of fire and water, I can't find the command names in the list of commands that can do that. I have tried ReSharper_MoveUp/MoveDown and that does not move lines up/down:

这将上下移动文本块.我只想逐行向上或向下,那里没有花哨的逻辑. 之前

This moves blocks of text up and down. I just want line-by-line up or down, no fancy logic there. Before

ALT + Up 之后(当光标在WriteLine行上时),我想看到以下内容:

After ALT+Up (when cursor is on WriteLine line) I would like to see this:

我已经看到了以下线程: eclipse在Visual Studio中相当于ALT + UP/DOWN(移动行)是什么?

I have seen these threads: What's the equivalent for eclipse's ALT+UP/DOWN (move line) in Visual Studio?, Visual Studio: hotkeys to move line up/down and move through recent changes, but none of the suggested solutions work in VS2012.

还有其他想法吗?

UPD 2012年11月7日:.扩展正在赶上Visual Studio2012.现在我知道至少有3个扩展可以提供此功能:

UPD 7 Nov 2012: . Extensions are catching up with Visual Studio 2012. Now I know at least 3 extensions that provide this functionality:

  • MoveLine Extension. Link provided by Carl G
  • Move Line Extension with modifications to 2010 version. By gius
  • Productivity Power Tools 2012. Have not actually tried this, but this blog post states it does the line move up/down

UPD 2012年11月15日:偶然发现了另一个扩展程序,该扩展程序声称可以满足此处的要求.不过还没有尝试过: LineMan扩展

UPD 15 Nov 2012: Just stumbled across another extension that claims it does what is required here. Have not tried it though: LineMan Extension

UPD 2015年5月10日:刚刚安装了VS2015 RC,它已内置:

UPD 10 May 2015 Just installed VS2015 RC and this is built-in already:

推荐答案

更新:huzzah, Tools.AddEndTokenAtTheEnd .)

Update: huzzah, Productivity PowerTools VS2012 is now available and offers this functionality (along with another personal favorite, Tools.AddEndTokenAtTheEnd.)

MoveLine扩展(与VS 2012兼容;我必须手动重新启动我的VS才能查看VS的键盘快捷方式工具中的命令.)

MoveLine Extension (compatible with VS 2012; I had to manually restart my VS in order to see the commands in VS's keyboard shortcut tool.)

这篇关于在Visual Studio 2012中向上/向下移动行快捷方式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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