In Visual Studio 2019 you can edit multiple lines in-line by pressing alt and using your mouse to drag down, you can then type and it will insert the text on the selected lines (very useful when the block comment in VS breaks your code styling rules):
I've previously used the keyboard combination of shift + alt + down arrow to select multiline for the same purpose but this binding has stopped working in Visual Studio 2019.
Can anyone point me to the binding that I need to re-map in Tools > Options?
I have resharper installed so will happily update one of theirs to do the same thing if such a binding exists.
I stumbled across this question, which was asking something similar but no-one actually mentions what the keyboard shortcuts are bound to:
Multi-line Editing in Visual Studio
Finally tracked it down!
In the keyboard mapping dialog in visual studio, you can set the binding to the following:
Edit.LineDownExtendColumn mapped to shift + alt + down arrow
Edit.LineUpExtendColumn mapped to shift + alt + up arrow
Hope this answer helps others.
Related
The usual multi caret short cut since VS2019 is
Ctrl + Alt + click : Add a secondary caret
as described in this answer.
After the installation of resharper it overrides this shortcut unfortunately with a navigation feature.
I looked throughout the shortcuts in environment-keyboard options in VS but apparently you cannot change or reinstate this shortcut according to this post.
How do I get my beloved multi-caret functionality back into my hands?
I found it! The Solution is to take away the key combination from Resharper.
Go to Resharper Options => Environment => Search & Navigation
and uncheck the Ctrl + Alt + Click checkbox:
and Visual Studio will allow you again to use the multi-caret functionality!
Here is the original link on how to disable the navigation functionality in resharper.
My quick watch (shift + F9) shortcut suddenly is not working.
But its alternate keyboard chord Control + Alt + Q works fine.
And all other shortcut seems working fine. But quick watch is the only one that I currently found.
I have tried other shortcut with Shift or with F9 , no problem.
I am also using Resharper, is that affecting VS Shift F9?
If you have Snag-It installed on your machine, its global shortcuts may override application specific shortcuts in Visual Studio (or other apps).
See #nuri's answer here: Visual Studio 2010 QuickWatch window not visible for instructions and screen-shots to change the Snag-It settings.
In the meantime, just go into the Snag-It preferences, the HotKeys tab, and set the "Video capture start/pause/resume" hot key to something other than [Shift]-[F9]. For myself, I only use "Global capture", so I set everything else to "None".
You can try the following:
In TOOLS --> Options | Keyboard, make sure the right mapping scheme is selected (Visual C# 2005 for me) and click Reset and finally, Ok
Does Visual Studio 2010 have a shortcut for quick fix?
I'm tired of grabbing the mouse, hovering over this red line, waiting for the little clipboard icon to appear, clicking on the first menu item. It would be so much fast to just open that dialog with some keys and confirming the first (i.e. selected) item.
The feature is called the "Smart Tag".
Default Keyboard Shortcut Schemes (ReSharper documentation)
Stack Overflow question How does one set Visual Studio 2010 keyboard shortcuts comfortably, especially when using ReSharper?
Stack Overflow question Visual Studio keyboard shortcut to automatically add the needed 'using' statement
They can usually be invoked via the keyboard using either:
Ctrl+. (on a standard QWERTY keyboard)
Alt+Shift+F10 (if you've not got Function Lock enabled)
If your cursor is on the item that is underlined, you can use Ctrl + . to pop up the intellisence/suggestion context menu.
Alt + Shift + F10 does the trick.
Via #Rohit from Visual Studio keyboard shortcut to automatically add the needed using statement
If you want to edit the shortcut of quick fix you can do the following:
Open Tools->Options->Keyboard and in the Show commands containing field enter EditorContextMenus.CodeWindow.QuickActionsForPosition and replace the old shortcut with the new one.
In Eclipse, selecting a line and pressing Alt + ↑/↓ will move the line up and down, a quick way to avoid copy&paste.
Is there an equivalent in Visual Studio?
In Visual Studio 2013 and later, this functionality is built in. ALT + UP/DOWN will move a line up or down.
If you need this functionality in VS2012 (works with VS2010 too), take a look at the MoveLine Visual Studio Extension or the Productivity Power Tools suite.
ReSharper's Ctrl + Shift + Alt + ↑/↓/←/→ is even more powerful - when on the beginning of the line, it will move the entire line, but can also be used to move entire methods, change the order of parameters, etc.
For me in Visual Studio 2019 it comes default closed.
For open it:
Tools -> Options -> Keyboard then select Edit.MoveSelectedLinesUp, click "Press shortcut keys" input and press Alt + Up (or whatever you want for it). And the other one is Edit.MoveSelectedLinesDown, click "Press shortcut keys" input and press Alt + Down (or whatever you want for it).
This is now working out of the box with Visual Studio 2013, same way as in Eclipse.
For Visual Studio 2013:
Tools -> Options -> Keyboard then select Edit.MoveSelectedLinesDown, click "Press shortcut keys" input and press Alt + Down. You also have to select the scope of the shortcut to be within "Text Editor".
In Visual Studio 2013 and later, you can move lines up and down using Alt + ↑ / Alt + ↓. Unfortunately this will not adjust the indentation if you move between blocks, as of today only ReSharper (and all other IDE's by Jetbrains including Rider) can help you with that.
To move entire blocks of code around you can move the cursor to its head and press Ctrl + m twice fast to collapse it, and then use the command above to move it around.
Here is a neat reference to all default keyboard shortcuts in different versions of Visual Studio.
With the VSCommands extension, you have exactly that keyboard shortcut. And, by the way, a Stack OVerflow notification toolbar :)
I am trying to learn the keyboard shortcuts in Visual Studio in order to be more productive. So I downloaded a document showing many of the default keybindings in Visual Basic when using the VS 2008 IDE from Microsoft.
When I tried what they say is the keyboard shortcut to view all open documents (CTRL + ALT + DOWN ARROW), I got a completely unexpected result on my XP machine; my entire screen display was flipped upside down!
Was this a prank by someone at Microsoft? I can't imagine what practical value this flipping of the screen would have.
Does anyone know what the correct keyboard shortcut is to view all open documents in VS 2008?
Oh and if you try the above shortcut and it flips your display the way it did mine, do a CTRL + ALT + UP ARROW to switch it back.
This is a conflict between your graphics driver and Visual Studio. Go to your driver settings page (Control panel) and disable the display rotation shortcuts. With this conflict removed, the shortcut will work in Visual Studio.