Visual Studio: Shortcut Info - visual-studio

for some/most of the functions in Visual Studio there do exist shortcuts. Sadly it's hard to find them.
I'm looking for a addin/tool that will display me information for a shortcut.
For example:
I comment a line with // and the tools gives me information that the shortcut for this is STRG + K, C.
I press some button, let's say debug and it shows me that the shortcut would be F5

For offline use there's the posters with key bindings, but inside VS I'd recommend the IntelliCommand extension which will show you key combinations when you press ctrl (+ some other key).

No other addin/tool required. In Visual Studio, under Tools > Options > Environment > Keyboard, you can find all available shortcuts.

Related

Is it possible to search for keyboard shortcuts by a keybind (Visual Studio 2017)

I want to find all shortcuts that are using a specific keybinding in an easy and reliable way.
In Visual Studio the only reliable way I've found so far is by changing a shortcut's keybinding and get list of shortcuts using the same keybinding. I think it's too roundabout and I'm looking for a way similar to VS Code.
In VS Code in the Keyboard Shortcuts tab you can search by a keybinding (by writing "Ctrl + R" for example) and you will get all shortcuts using that keybinding.
Is there a similar way to do this in Visual Studio?
If you open Visual Studio keyboard options and Press shortcut keys in the corresponding box, in the Shortcut currently used by list you will see all commands for this shortcut:

Ctrl+K was pressed. Waiting for second key of chord

I'm using Visual Studio 2013 Ultimate and when I select a code to be comment I press Ctrl+K but it show me this once I pressed Ctrl+K was pressed. Waiting for second key of chord... any idea how to fix it?
There is a command Ctrl K+C to comment any line, and Ctrl K+U to uncomment.
You can see what the keyboard binding is under Edit > Advanced > Comment Selection (2010):
And 2013:
Additionally, you find keyboard bindings under Tools > Options > Environment > Keyboard. Here if you search for "Comment", you can find the Edit.CommentSelection (and Edit.UncommentSelection) which you can assign whichever shortcut you prefer.
You can look after and manage your shortcuts in Tools / Options, Environment / Keyboard.
You should see a dropdown menu where all shortcuts are listed.
There you can change your existing shortcuts or reset them to the default.
The default shortcut for me (Visual Studio 2015 Community Edition) to comment was Ctrl K + C and to uncomment Ctrl K + U.

Change keymap in Resharper?

I've applied the default (IntellJ IDEA) keymap to the Visual Studion and want to change some mapping to my custom, for example Generate Code (Alt+Ins) . How can I to do it or it is impossible .
P.S.Visual Studio 2010, Resharper 6.1
Go to Tools -> Options -> Environment -> Keyboard and find the relevant ReSharper shortcut in the list (I think the one you mentioned is called ReSharper.ReSharper_Generate).
Put your cursor in the Press shortcut keys box, press then shortcut combination you want to use for it, and then press the Assign button. You should now be able to use your new shortcut to access the command you chose.
Menu - ReSharper > Options... > Environment > Visual Studio Integration > Kayboard Shortcuts - you can choose VS

Visual Studio - Shortcut to Navigate to Solution Explorer

Is there a keyboard shortcut in Visual Studio (aside from CTRL+TAB and selection) that would take me from inside a document directly into the solution explorer? I don't want to customize any shortcuts or change any default behavior.
CTRL+ALT+L
should shift focus to the Solution Explorer.
For visual studio 2012 use:
CTRL+[ + S this selects your current document in the solution explorer.
When using VS 2012 with the Visual C# 2005 keyboard mapping scheme:
CTRL+W, S
I find this easier to memorize: All shortcuts beginning with CTRL+W are for opening or navigating to W indows:
CTRL+W, S: S olution Explorer
CTRL+W, E: E rror list
CTRL+W, R: R esourceview
CTRL+W, A: Command window (A ction ...)
CTRL+W, T: T askview
CTRL+W, Q: Find Symbol Results
CTRL+W, X: Toolbo x
CTRL+W, C: C lassview
CTRL+W, P: P roperties
CTRL+W, B: B ookmarks
...
In Visual Studio 2012 you can now use CTRL+; as this is the default keyboard shortcut for the solution explorer search box.
On my windows 7 machine : Ctrl+ALT+L locks the computer.
For me
: Shift+ALT+L
works. (This could also be a resharper configuration)
shortcut ctrl [, S will focus current open file/document in solution explorer.
setting checkbox to true in "Track active in Solution Explorer" will automatically focus current open file/document in solution explorer (Tools->Options->Projects and solutions->General->"Track Active Item in Solution Explorer"=true
The default keyboard shortcut for opening/jumping to Solution Explorer is Ctrl + Alt + L.
Extended above : command name for sync tab with solution explorer is "SolutionExplorer.SyncWithActiveDocument"
Visual Studio
2015 and 2017 (by default) VS 2017 Shortcuts
Ctrl + [, S
Runs Keyboard Shortcut
SolutionExplorer.SyncWithActiveDocument
ReSharper
In Visual Studio 2015 and 2017 (by default) Resharper Docs
Shift + Alt + L
Which runs Resharper's Keyboard Shortcut
Resharper.Resharper_LocateInSolutionOrAssemblyExplorer
Both
Focus Solution Explorer
Highlight document
Scroll / expand nodes (as required to show that document)
Difference
Resharper's version also works with decompiled code. Locating decompiled symbols in the Assembly Explorer window.
To customise / it doesn't work :
Tools > Options > Environment > Keyboard
Search shortcut name (e.g. SolutionExplorer.SyncWithActiveDocument)
Assign (in Global) to Keyboard shortcuts as you like
I had this problem on a new machine build with VS 2013 and R# 8.2.
Keyboard option Resharper.Resharper_LocateInSolutionExplorer was correctly set to Shift+Alt+L, but it seemed to be only opening a parent folder and not selecting the actual file. As recommended in another post I enabled "Track active in Solution Explorer" in the VS Options.
This didn't fix the problem and wasn't what I want because in very large solutions I don't want the solution explorer jumping around to the current file in use. I disabled the Track feature and restarted VS, the LocateInSolutionExplorer feature then started working correctly. Some sort of shortcut precedence issue?
ctrl + [ + S.
This shortcut will highlight the currently opened document in solution explorer.
For AZERTY keyboards like mine, the default shortcut is Ctrl+), Ctrl+S
Ctrl+Alt+L works fine even in VS 2019.
But if you have reassigned the above key to some other command (by mistake in my case) then the name of the command is View.SolutionExplorer
You can search it in the Tools -> Options -> Environment -> Keyboard
or just do Ctrl+Q and search keymap.
And then search View.SolutionExplorer in the Show commands containing: and assign whichever key you want.
We just upgraded from VS2013 to VS2017, and I had to go looking for how to auto-select the active tab in the Solution Explorer. I often have to look for a document by finding a text-string from a screen, and love to have it select the document so I can see where it is.
Tracking the active document has been default behavior for a long time. VS2017 brought over ALL my other preferences, but not this one. Glad I found this thread--Thank you.

What's the equivalent for eclipse's ALT+UP/DOWN (move line) in Visual Studio?

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 :)

Resources