Set Add Class shortcut key in Visual Studio - visual-studio

I used to used the shortcut Ctrl + Shift + C to add a new class in Visual Studio 2015. This seems to have gone away when I'm using a different machine. How do I set this?
I've looked in Options > Environment > Keyboard but I can't see anything obvious...

Navigate to Tools >> Options >> Environment >> Keyboard, search for commands containing Project.AddClass and setup the shortcut you want
Steps to setup a shortcut
Search any command like AddClass in Show commands containing box
Select a desired command
Click on the blank Press shortcut keys box
Press desired key / key combination for shortcut using your keyboard

Also, see article Visual Studio Shortcuts and Add on Tools...
This article explains the same in more detail with some other interesting (and perhaps even relevant) points.

Related

Visual Studio 2013 - Search Short Cuts (hot keys)

In visual Studio, is there a way I can set up hot keys to quickly switch between searching in all open documents, entire solution or current document?
It is sooooo slow to have to use the mouse to change the option from the ctrl+f or chift+ctrl+f search menu.
...gregory
Please see this
https://msdn.microsoft.com/en-us/library/5zwses53.aspx
On the menu bar, choose Tools, Options.
Expand Environment, and then choose Keyboard.
this is a command for find in files 'Edit.FindinFiles' default hot key is 'Ctrl + Shift + F'.
You add any new short key as you like
Hope this help....

Waiting for second key of chord

I have assigned the keyboard shortcut Ctrl+E to a command. But when I click Ctrl+E, the status bar says Ctrl+E was pressed. Waiting for the second key of the chord...".
If I hit the Esc key, I get "The key combination (Ctrl+E, Esc) is not a command."
How do I activate the command that has been assigned to Ctrl+E?
I know that this is the same as the question How do you stop Visual Studio from waiting for the second part of a shortcut-combination? . But the answer given there (hit Esc) does not work for me.
The selected answer is wrong in stating you cannot use Ctrl+E by itself (at least for Visual Studio 2013).
For those who come from a Mac or other OS background where Ctrl+E takes you to the end of the current line (the End key shortcut by default in VS), this is a really frustrating limitation when switching environments.
I found that in Visual Studio 2013 at least, you can remove all the shortcuts that use the Ctrl+E chord (none of which I will ever use) and set the Edit.LineEnd command to Ctrl+E. It just takes a few minutes tracking down the chords to remove (most of them are under the workspace designer).
To see which commands are using your keyboard shortcut at the moment, enter it
in the "Press shortcut keys:" edit box. Make sure you don't accidentally click "Assign".
In the dropdown box "Shortcut currently used by:" you can browse
through and manually remove all commands that
currently occupy your desired shortcut combination.
Key chords are a keyboard shortcut feature of Visual Studio. They consist of a sequence of key presses like (Ctrl+K, Ctrl+C) for comment code or (Ctrl+K, Ctrl+U) for uncomment code.
They are activated by the user pressing one Ctrl+key combination, then another Ctrl+key combo. For example Ctrl+K, Ctrl+C on my install of Visual Studio is used for commenting selected text.
In your case, Ctrl+E is a common chord starter and is used by many chords. For example Ctrl+E, Ctrl+W = Toggle Word Wrap and Ctrl+E, Ctrl+X = Workspace Designer.ExpandAll.
Depending on which developer setting you've chosen for the IDE, Visual Studio might have Ctrl+E mapped to other chords. In that situation, you cannot use Ctrl+E by itself for a keyboard shortcut
If this is the case, you can create your own chord, Ctrl+E, Ctrl+D is not in use on my install of Visual Studio 2012.
Edit:
Also if you remove all key chords that start with (Ctrl+E) then it can work as a non-chord shortcut.
And your question is not the same as the other question. In that question, the OP has started the chord process (Ctrl+E) and wants to cancel Visual Studio from waiting for the 2nd chord key.
I came to this question because I had the same problem as the OP, but in the Integrated Terminal of Visual Studio Code (not Visual Studio).
My problem:
I couldn't stop the node server by doing Ctrl+C, because my VS Code was waiting for the "second key of chord"...
I fixed it in the user settings, by unchecking the Allow Chords checkbox.
I answered the more suitable question for me here.
I have had the same issue with my "<" [backquote] key and wasn't able to find the right keybinding in the normal settings. Allow chords wouldn't do anything either.
This is for anyone, who isn't able to reasign the key in the default keybindings:
Find the User settings in your terminal.
Windows %APPDATA%\Code\User\
macOS $HOME/Library/Application Support/Code/User/
Linux $HOME/.config/Code/User/
Open the keybindings.json file
look for all chords that you would like gone.
(Obviously) remove/alter them
I hope I could help some of you!
You can disable it only for the integrated VSCode terminal by adding the following to your setttings.json file:
{
...
// Disable chords for terminal usage
"terminal.integrated.allowChords": false
...
}
Go to Tools -> Options.
A window will open up, In that Environment -> Keyboard -> Keyboard
And Just Press the Reset button on the right.
Screenshot
Do
ctrl+ E
then
ctrl + V
More info here:

Why does VS2012 think my command keys are me attempting to edit code?

E.g. when I hit Ctrl-D, I for an immediate window, I have to move my mouse pointer out of the code window, or I get told I'm not allowed to edit code while it is running. I've only recently encountered this.
Not knowing how your Visual Studio is setup, I cannot say. However, try doing the following:
Open Visual Studio 2012 then go to Tools > Options...
In the Options menu, go to Environment > Keyboard.
From there, click inside the "Press shortcut keys:" input box and, using your keyboard, type CTRL + D. Once you do that, it will show you what command is currently using that shortcut.
Finally, type in the command name in the "Show commands containing:" input box. Click the command name from the list below, then click 'Remove'.
Hope this is what you are looking for! Let me know if you have any other questions!

Shortcut to rebuild solution in Visual Studio 2008

The shortcut to Build a solution in Visual Studio 2008 is Ctrl + Shift + B.
I would like to know the default shortcut to Rebuild the solution.
The command Build.RebuildSolution is not bound to any key combination in the standard profiles. However you can use the following trick to invoke it
Alt + B, R
This will navigate to the build menu via Alt + B and then R will select the Rebuild option
Another way is to do this:
Tools >> Options >> Environment >> Keyboard.
Locate the textbox decorated by the 'Show commands Containing' lable.
Type >> 'Build.Rebuild'
Select >> the rebuild type you want, you have two options to choose from.
Locate the textbox decorated by the 'Press shortcut Keys' lable.
Hit >> 'a key on your keyboard', i.e I used F6 for solution wide rebuild.
Click >> the assign button.
CLick >> O.K and to exit.
Finally load up a test project to test out the short cut.
In my installation, there is no default. I am configured for C#, it's possible other configurations will define this by default, but I don't think so. You can see if there is a key assigned by going to Tools -> Customize, clicking the Keyboard... button at the bottom and typing "Build.RebuildSolution" in the Show Commands Containing edit box. If there is a key assigned, it will show up at the bottom of the dialog.
There is no default shortcut to Rebuild Solution.
In addition to the ways mentioned in other answers you can perform the rebuild by
Create a Visual Studio Macro that rebuilds the solution and assign a keyboard shortcut to macro. The advantage of this approach is that you are no longer restricted by the commands provided in visual studio. You can create a custom operation like rebuild the solution, launch the application process and attach the visual studio debugger to the process. All this in a single keyboard shortcut!

Is there a shortcut key to switch between split panes in visual studio/management studio?

When I have a file open in visual studio/sql server management studio and have it split in to two panes, I'd like to be able to switch between the panes without having to reach for the mouse. Does anyone know if a shortcut key exists for this?
F6 is your friend.
I think you can assign this by going to Tools -> Options -> Keyboard and searching for SplitPane. You should be able to assign shortcut keys for the following values:
Window.NextSplitPane
Window.PreviousSplitPane
CTRL+F6 will cycle through your files and across panes.
In SSMS: right-click toolbars, customize. Under categories, select Window, then under Commands select "Next Split Pane". Drag to toolbar. Right-click and change name to "Next Split P&ane". You can now use alt-a to change split pane.
On Microsoft SQL Server Management Studio (SSMS) 2012, I figured out that it is the combination of Ctrl+Shift+UpArrow(or DownArrow). :-)
This was not easy for me for some reason. This method finally worked (similar to Steve Dignan's answer above but I don't have enough rep to comment yet).
In VS 2012, Tools, Options, Environment, Keyboard.
"Apply the following additional keyboard scheme" set to "Visual C# 2005".
"Use new shortcut in" set to 'Global'.
Enter "splitpane" in "Show commands containing" to get only the 2 desired commands.
Select the first one and remove any shortcuts already assigned.
Click inside the "Press shortcut keys" box and use "Ctrl + Alt + Up Arrow" for prev and down arrow for next.
If either of those shortcut chords are currently used by something else, you may need to search on that command and remove it from there. Then come back to the split pane commands and Assign.
Don't forget to close VS before you open another instance of it.
For Visual Studio 2010 (maybe others as well) F6 will work to jump between split panes if Tools -> Options -> Keyboard does not use the Visual C# 2005 keyboard layout additionally (which was the case for me for I-don't-know-why reasons - maybe I said yes to an installer/first-start question a long time ago).
Of course you will no longer be able to build your project with F6 afterwards. ;-)
For Visual Studio 2012: Tools -> Options -> Keyboard -> search by Window.Split and add a new shortcut.

Resources