I don't know if something has changed recently in Visual Studio 2015 but before I was able to press ALT + UP ARROW KEY
or ALT + DOWN ARROW KEY
to move lines in code up or down and now it does not do anything.
I went into Tools > Options > Environment > Keyboard
and I cannot find anything like in the past called
ProjectandSolutionContextMenus.Item.MoveUp
or
ProjectandSolutionContextMenus.Item.MoveDown
Also here in the list of VS2015 I don't see that option: http://visualstudioshortcuts.com/2015/
How to achieve this?
Alt + ↑ (Up Arrow) – Moves a line up. Alt + ↓ (Down Arrow) – Moves a line down.
Moving lines: You can move lines up and down by pressing ALT+UP or ALT+DOWN. No need to select, cut, or paste! Duplicating lines by pressing CTRL+ALT+UP.
With your caret on a line, you can press ⌥⇧↑ (macOS), or Alt+Shift+Up Arrow (Windows/Linux), to move a line up. Alternatively, you can move a line down with ⌥⇧↓ (macOS), or Alt+Shift+Down Arrow (Windows/Linux). The same shortcut can move a selection up or down.
The commands you are looking for are Edit.MoveSelectedLinesUp and Edit.MoveSelectedLinesDown. Shortcuts for them should be defined in the Text Editor context.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With