How can I change the keyboard shortcuts in Visual Studio? - visual-studio

I would like to change the keyboard shortcut for quick fix in Visual Studio 2013, so that it matches the ReSharper equivalent (which I only use on my office machine). How can I do it?

One way to do it is to enter on the menu 'Tools', 'Customize' and click on the 'Keyboard...' button near the 'Close' button.
Inside this option you can search for the commands by name (I couldn't find the Quick Fix here), maybe you want the Edit.FormatDocument one, that makes the indentation for the documents automatically.
If you can't find this option, tell me your quick fix actual keyboard shortcut, so I'll be able to check which function it calls.
I did some research on the R# QuickFix option and maybe what you want is this is the option you want: View.ShowSmartTag.

Look at this doc: Identify and customize keyboard shortcuts in Visual Studio

Related

In visual studio, my hotkey F12 doesn't expand my inherited functions

I'm not exactly a programmer, but I've just started learning C# for Unity so I can design a simple game.
The tutorial I'm following says to press F12 to expand the inherited functions. When I press F12, nothing happens. One solution was to try CTRL F12, but that also didn't expand anything. I'm not sure if I'm missing something, since I'm very new to all of this, any help would be appreciated.
The standard definition for the F12 shortcut is Go To Definition. This option can be seen with right clicking what you want to, well, see the definition.
If you think you accidentaly changed the shortcut somehow, then you can check your actual shortcuts going on Tools > Options... > Environment > Keyboard
This is where you change your shortcuts if you want.
On the searchbox you can type Definition and it will show the command you are looking for.
I also recommend checking Visual Studio's documment about shortcuts for a list with all standard shortcuts.

Is there a keyboard shortcut to move the cursor between methods in Visual Studio 2010?

Is there any keyboard shortcut to move the cursor between methods in Visual Studio? Is there any plugins that can do the same job?
All the time when I program, I want to go at the end of the current method and if I could have a shortcut that can move the cursor at the beginning of the next method and then just have to type a couple of up arrow to be where I want would be fantastic.
Thank you.
Note: For VS <2015, the following works only for the VB.NET code editor. In VS 2015+, apparently the C# code editor is also supported.
While there are no default keyboard bindings to jump between methods, you can set them up yourself:
Go to Tools → Customize…, then Keyboard…, and do the following:
Search for the commands by typing Method in the input line at the top.
Locate the two commands Edit.NextMethod and Edit.PreviousMethod.
For each of these, select the command first, then move the input focus to the input field Press shortcut keys, enter an unassigned key combination, and press the Assign button.
(The screenshot above shows that I have previously assigned one of these commands to Ctrl+Shift+<.)
Hi another (cheaper) alternative might be the CTRL+M+M to collapse/expand the current method to it's definition, allowing you to quickly navigate to the next.
Also CTRL+M+O to collapse all members is useful, with CTRL+M+L to expand all again.
Visual Studio doesn't have such a function, but JetBrains' ReSharper does. At least is the only one that I know of to offer this functionality.
For ReSharper the shortcuts are Alt-Up and Alt-Down, for previous/next member.
Try CTRL + ALT + UP. This first takes you to the scope selector where you can select a class if applicable, then press TAB which takes you to the method selector where you can select a method from the selected scope.
Note I use In Visual Studio 2012, don't know if works in other versions.
Jason Malinowski is right on his comment. It even says the shortcut keys are Ctrl+Down Arrow and Ctrl+Up Arrow. I used to use this all the time in VB6, but when I tried it lately using recent versions of visual studio, it didn't work; it would just scroll the edit window up or down one line.
When I went into Tools -> Options, select "Environment" on the left, and then the subcategory of "Keyboard", then type "Edit.ScrollLineDown" it said Ctrl+Down Arrow. When I removed this shortcut (and the one for ScrollLineUp), the next/previous method shortcuts then worked! I'm personally very happy about this.
Obviously, if you can find the right command, you can customize your keyboard shortcuts any way you please here.
I know this is old, but looks like it was added since.
Try Alt+[ or Alt+]
In Visual Studio 2013 with the commercial Visual Assist expansion you can use ALT+M to open a list with all methods in the current file. Select one, hit ENTER and the cursor will jump to it.
do not forget about the excellent, free DPack extension, which will add Alt+m shortcut which will open a list of all methods in the current class. You can type a search string to filter, and what is also great is if you tab down and enter on a method, and then later do Alt+m again, if you tab into the window you will be on the last method you selected. DPack also has many more features, like bookmarks, but I do find that you have to setup the hotkeys, or more exactly, re-assign hotkeys from other functions to DPack: https://marketplace.visualstudio.com/items?itemName=SergeyM.DPack-16348
Its Ctrl + } - by placing the cursot to end of line - using studio 2015
Same will also bring the cursor back to bottom.
so place the cursor at end of function and press Ctrl + }
In Visual Studio 2015:
Alt + Up or Alt + Down

visual studio shell F# keyboard shortcuts

I've started using F# with the visual studio shell and I like the capability to be able to send lines to fsi by highlighting them, but the alt+Enter shortcut is really awkward and I would be much happier with this being on shift+Enter. (mainly since shift+ up/down arrow is select lines already)
Does anyone know how to change this? Thanks.
You can alter the keyboard mappings within Visual Studio. If you go to Tools -> Options -> Environment -> Keyboard, you'll see a window like the image below.
In order to check existing bindings, place the cursor in the "Press shortcut keys:" box and hit "Shft+Enter". You'll then see any potential conflicts in the drop-down box as shown.
In the example below, I'm searching through Global, which means shortcuts for anything in the application. You can switch it to be just the console or whatever you like.
Once you're happy with the shortcut you want to use, you need to select the command from the window containing all of the Action.* lines and then press Assign.
So I don't mean to be trite, but have you tried mapping the key?
So for F# Interactive I see Alt+Enter mapped to:
ClassViewContextMenus.ClassViewMultiselectProjectreferencesItems.Properties
Have your tried mapping Shift+Enter (or whatever) to that command?
Tools->Options->Environment->Keyboard
You should be able to get it all working from there.

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.

Visual Studio 2005 quick file search

In Eclispe you can do Ctrl+Shift+R and a Window popup where you can write the name of the file (or just the beginning of it) and to press enter to go directly to the file.
What is the equivalence in Visual Studio 2005? (Ctrl+Shift+F is not what I would like).
From Top 11 VS 2005 IDE tips and tricks:
This is the Find dropdown that is on the Standard Toolbar, not the Find dialog. Use the shortcut CTRL+D to activate the Find dropdown in normal mode. Use CTRL+/ to activate the Find dropdown in command mode
To quickly go to a file, type CTRL+D, >open <start of file name>. Intellisense works here just like in the Command Window. "of" (short for "open file") can be used instead of open.
I am not sure if there is a built-in command but there are some addons like VS File Finder
Hit Ctrl+D (Find Combo - the one in the toolbar), write ">of " and the name of the file.
I am using ReSharper, so I am not sure if the shortcut is exactly this one in your case.
I don't know if there is an equivalence, but you can probably do it with the macro editor. It's pretty powerful and you can do pretty much what you want with it.
In plain VS.NET 2005, Go to the command window (Ctrl-D), type "openfile" (or just "of") and the file name.
If you have Resharper (and you should have it), you can type Ctrl-N and type in the class name, or Ctrl-Shift-N and type in the filename.
Gulzar proposed VS File Finder that was the greatest solution here.
But I installed SonicFilFinder because the GUI was better. It works like a charm and you can use the HotKey you want. Really fast and no need of of the mouse. It's free.
In VS 2010, you can use Edit > Navigate To... (Ctrl+comma).
Pro:
Also searches objects/methods
Con:
Doesn't support * wildcards
Window isn't dockable
See: MSDN Blog

Resources