VS2010: Can a keyboard shortcut run more than one command? - visual-studio-2010

Is it possible to assign more than one command to a keyboard shortcut in Visual Studio 2010?
What I really want to do is this:
Ctrl-B : Save current file, run an External Tool
(Essentially the same as Ctrl-S, Ctrl-B)

You can create a small Visual Studio macro with two calls to DTE.ExecuteCommand and assign your Ctrl-B shortcut to this macro.

Related

Visual Studio shortcut for opening command prompt in current project path

On a keyboard shortcut, I want to be able to start the Windows command prompt with the working directory set to the current project directory selected in solution explorer (or text editor). Unfortunately, I am unable to find an appropriate keyboard shortcut in the Visual Studio settings.
Is such a thing possible inside Visual Studio and Visual Studio Code? And if so, how can I set it up?
Sure this is possible!
Configure an external tool
You have to set up a custom external tool. For that, go to Tools > External Tools... and click Add and configure the tool like this:
Setup the keyboard shortcut
Next, you want to bind a shortcut to that external tool. For that go to Tools > Options > Environment > Keyboard and bind your desired shortcut to Tools.ExternalCommand1. Make sure you have moved the external tool to the first position in the window shown above.
Additional Information (For Visual Studio Code)
To Open New Command Prompt use Ctrl+Shift+C to perform same action
named workbench.action.terminal.openNativeConsole

Single key hotkey mapping in Visual studio

I am wondering if there is a way to set a single key keyboard shortcut in visual studio. IN al my other editors (Android studio and sublimeText) I have the key [`] mapped to goto line. In visual studio it will not let me assign that. But if I push ctrl first it will.
Although I REALLY do not recommend single-character shortcut, you can do it. After all, you are the master of your system :)
First, create a shortcut with Ctrl+ or Shift+. Close the Studio. Open the user's settings file CurrentSettings.vssettings located in %USERPROFILE%\Documents\Visual Studio 2013\Settings folder with any text editor. Locate that key binding and simply delete Ctrl+ part. Save. Done.
This is more a workaround than a solution, but you could create a simple Autohotkey script to map the backtick to a Ctl + backtick:
`::^`
You could even limit the effect to Visual Studio by using the #IfWinActive directive.

Does Visual Studio support a "shortcut hierarchy"?

I have Visual Studio 2013 and ReSharper. I like to have F12 bound to ReSharper's "Go To Implementation" command, but it is not always an option. So when there is no option to go to the implementation, I want F12 to revert back to the Visual Studio default of "Go To Definition" (where there is a definition). Is this setup possible?
I'm afraid not. A keyboard shortcut can only be bound to a single command for a single scope. That is, you can bind a keyboard shortcut to one command for the text editor, but another command for, say, the XAML designer. There's no way to "fall back" to another command (how would you know when to fall back?)

Launch Visual Studio 2010 with new document?

Is there any way to launch Visual Studio 2010 with a new document instead of the usual start tab?
I'm just curious--I usually use Notepad++ to jot down quick things, but Visual Studio seems like it would be preferable.
Here are your choices.
Curious, though, as to why you would want to open a full-fledged IDE just to take notes. That seems like precisely the kind of thing a notepad application is suited for...
You can make a shortcut that always launches a specific file, e.g.:
Put a document called "notes.txt" on your desktop.
Copy the Visual Studio 2010 shortcut to your desktop (to a new shortcut)
Edit the shortcut properties (right click → properties → Shortcut tab → Target) to add this to the end of the Target:
/edit "%USERPROFILE%\desktop\notes.txt"

How does one set Visual Studio 2010 keyboard shortcuts comfortably, especially when using ReSharper?

In every Visual Studio.NET version you can set keyboard shortcuts using menu Tools -> Options -> Environment -> Keyboard and then find the command you want to assign a shortcut to by entering part of it in "Show commands containing".
For one thing, the listbox is ridiculously short and hard to navigate - is there an alternative?
Then, how do I find out the correct command name for a specific action?
Specifically, I'm using ReSharper 5.1 with Visual Studio 2010 and want to have the Alt + Enter shortcut back (it used to be there in older versions by default) that opens the ReSharper context menu when the cursor is over a curly underline ReSharper uses to highlight errors or warnings.
How do I find out the command name for that (except by an educated guess)?
The way I do this is to perform an action while recording a macro (using Tools / Macro / Record temporary macro).
When I have finished with the action, I look at the source code of the macro and it usually helps to find the correct command.
For example, I have just let R# add some magic through Alt-Enter, and the macro recorder has:
DTE.ExecuteCommand("ReSharper_QuickFix")
You can rebind all of the ReSharper shortcuts by using the ReSharper -> Options -> Visual Studio Integration page. Select a keyboard scheme and hit "Apply Scheme".

Resources