开发者

Visual Studio Key Strokes: Swapping lines

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 开发者_StackOverflow中文版were pressed, then:

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


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


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


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.


For Mac, It is: option + /

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜