What are your most frequently used shortcut keys in visual studio? [closed] - visual-studio

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 9 years ago.
Improve this question
Recently , I found some shortcut key really helpful which I never used before .
Such keys like F7 ,F3 ,Ctrl+g help me a lot when editing and debuging.
What are your most frequently used shortcut keys in visual studio?

including Resharper's shortcuts:
Ctrl-Shift-B (build)
F12 (go to definition)
Shift-F12 (find usages)
Ctrl-- (go to last location)
Alt-Shift-L (go to current file in the solution explorer)
Alt-\ (find member)
Ctrl-T (find type)
Ctrl-Shift-T (find file)
Shift-Esc (close current dialog)
Ctrl-Shift-S (save all files - VS tends to forget)
EDIT: added explanations

I always use the debugging keyboard shortcuts - F9 (toggle breakpoint), F10 (step over) and F11 (step into). I can't believe that some of my coworkers actually use the toolbar buttons for this - it's insanely more efficient to use the shortcuts.

Standard VS keys of F12 for going to the definition and then CTRL+- to go back to where I was before that.
Probably the two shortcuts that get me around VS and my code quicker than any other.

Ctrl + . for bringing up the smart tag for adding namespaces, renaming/refactoring, etc.
I also remapped Ctrl + B to build, Ctrl + Shift + P to Build Selection (in a sense, Build Project) and Ctrl + W to close window.

CTRL+K CTRL+C for comment selection and CTRL+K CTRL+U for uncomment selection (They may be mapped to CTRL+E CTRL+C and CTRL+E CTRL+C in some standard keyboard mappings, but the first two will generally still work...)

The most used keyboard shortcut is Ctrl-Tab to switch between tabs.
Another one I use alot is Ctrl-I to start incremental search.

Two more:
Alt+Ctrl+C for Call Stack
Alt+Ctrl+I for Immidiate window
(Both helpful while debugging)

The list is endless. To maximize readble code space, I've removed all my toolbars. If I want to do it, I have to know the keyboard shortcut for it.
Aside from the basics, I constantly use things like Ctrl-M,O, Ctrl-K,C, Ctrl-K,U, Ctrl-K,D, Ctrl-Alt-E, Ctrl-Alt-P. I have also made a little smiley-face button for "Remove and Sort Usings" because navigating through the right-click menu takes too long and it doesn't have a hotkey that I know of.

Ctrl+Shift+F9 to delete all the break points in a solution. Very handy when people leave them spattered all over the solution!

Shift + F6 to build current project, Shift +F5 to stop debugging

I use many, but most useful I think is
CTRL+K Kfor setting a bookmark
and CTRL+K N for going to next bookmark and CTRL+K P for previous

CTRL+D and then ">of $filename" (open filename),
CTRL+K+C (comment selection),
CTRL+K+F (format),
CTRL+X and CTRL+C on a line to cut
or copy the entire line

I use the bookmark shortcuts alot: Ctrl-K Ctrl-K to create a bookmark, Ctrl-K Ctrl-N to cycle through them.
Ctrl-Shift-B to build is probably the most executed though.

Ctrl + B
which for me is build current project.
I use it less in VS2008 SP1 with the error highlighting so
Ctrl + D
which for me is Go To Definition is starting to edge it out.

I never can remember shortcuts, but Ctrl + - . is one of the few I can remember and use often. With Resharper installed, Alt + Enter is Ctrl . on steroids. Both intelligently resolve a variety of errors or refactorings.

Related

Does Visual Studio have a begin selection/set mark command like Emacs?

In Emacs, one can begin a selection (more accurately "set the mark") by pressing Ctrl-Space. Then, one can navigate around the file, e.g. by pressing End to go to the end of the current line, and the selection will follow the caret.
There is more to the Emacs mark than that, but my question is:
Does Visual Studio 2013 have a way to begin a selection at the caret and have the selection follow the caret until ESC is pressed, or something similar? Visual Studio has a command called "Edit.EmacsSetMark", but it does not seem to work for me.
I only know of SHIFT + cursor keys (including PgUp/PgDn, Home/End, and most of them also with Ctrl). Could take a bit of practice in your case, but very convenient IMO. The selection is cleared as soon as you use a cursor key with SHIFT released.
Even rectangular selections are supported if you also press ALT.
Then there is also the mouse of course. With variations by using SHIFT (extend selection) and ALT (rectangular).
Not that I know of for 2013, but you could do it in 2010 with this...a link

Is there a keyboard shortcut to view the meaning of a squiggly line in Visual Studio?

It'll be nice if I could view the meaning of a squiggly line without doing a mouse hover.
Ctrl + K, Ctrl + I - Edit.QuickInfo command.
It's Ctrl-. or Shift-Alt-F10 (View.ShowSmartTag).
I'm surprised that the question hasn't been answered for more than half a year. I've been using C# for a day and already have found it annoying to reach for the mouse every time to add a 'using' statement.
Not exactly the answer, but a helpful shortcut I usually use to go through errors without using the mouse is F8, which cycles through the Error list (errors, warnings, messages)

How to navigate back to the last cursor position in Visual Studio?

What is the keyboard shortcut navigate back to the last cursor position in Visual Studio?
It Will not work for red color (-) key. For me it only works for blue color combination.
According to Visual C# 2008 Keybinding Reference Poster it is Ctrl + -. The name of the specific keybinding is View.NavigateBackward.
PS: While researching I also found that Ctrl + . is the same as Shift + Alt + F10. Nice!
ctrl + - (dash) navigates backward.
ctrl + shift + - (dash) navigates forward.
These settings can be found under Environment -> Keyboard:
For Changing the setting in Visual Studio 2019:
Search for view.navigate
CHOOSE "Text Editor" from the "Use new shortcut in:" drop down menu
Select your shortcut
Global doesn't catch for this.
For new VS Code(1.28.2)
Back: Ctrl+Alt+- (dash)
Forward: Ctrl+Shift+- (dash)
The most generic answers is: there is no working default and you need to define your own keyboard shortcuts for View.NavigateBackward and View.NavigateForward.
Why? For most keyboards, the default shortcut is a broken, unusuable combination because VS badly handles the shift and altGr modifiers. MS did not pay attention to portability and internationalisation so much when they redeveloped VS after version 6, and this is still true today. This bug has been there for way more than a decade, nearly two decades. At this rate, it will never be fixed. And yes, I have filled a bug report, and I'm certainly not the only one.
However, their "VSCode" product line does have better keyboard handling as it doesn't depend on the shift or altGr modifiers to identify the key. For example, when you are in text writing mode and press the key that has the dash symbol, without using shift nor altGr, let's say it writes something else, like number 6. To VSCode when it comes to shortcut handling, that's still the dash key for its purpose. As long as a key has the symbol written on it, whether this is painted as the 1st, 2nd or 3rd level doesn't matter, it just that key.
Of course, it's never a good thing to make the default shortcuts use non-alphanumeric symbols, that's always confusing, whether it works or not. The good mature text editors have known that for a long time and should be taken as examples of things done right. In some ways, VS learned a few good things from emacs with shortcuts that are a sequence of two letters, but ultimately screwed up on other parts with the choice of non-alphanumeric bindings, combined with a broken low-level keyboard handling.
This works for me in Visual Code
Navigate backward Alt+←
Navigate forward Alt+→

Keyboard shortcut for Visual Studio/Resharper tooltips?

Is there a keyboard shortcut to display tooltips provided by Visual Studio & Resharper when you hover over a bit of code? I'm already aware of Quick Documentation (Ctrl + Q) and Quick Watch (Ctrl + Alt + Q).
Do you mean Ctrl + K, Ctrl + I? This is the command Edit.Quickinfo.
(sorry, I am unable to add a comment with the PC I have now)
For the single variable, do you mean in debug mode ?
2nd Edit: I think VS names these tooltips 'datatips'. Unfortunately, there is no command to show them, so no possible shortcut.
You can do it by binding this command to a key:
EditorContextMenus.CodeWindow.PinToSource
Unfortunately it works with what you have selected, not with what you are hovering over. Not only do you have to do the extra click, but you need to select the entire variable name and all of its prefixes as well.
Old question but useful to know.
My shortcuts:
PinToSource set to alt-F1
ClearAllDataTips set to shift-alt-F1
CTRL+ALT+Q
It is equivalent to
SHIFT+F9

Favorite Visual Studio keyboard remappings? [closed]

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 9 years ago.
Stack Overflow has covered favorite short-cuts and add-ins, optimizations and preferences -- great topics all. If this one has been covered, I can't find it -- so thanks in advance for the link.
What are your favorite Visual Studio keyboard remappings?
Mine are motivated by the fact that I'm a touch-typist. Mouse, function keys, arrow keys, Home, End -- bleh. These are commands I do all day every day, so I've remapped them to sequences I can execute without moving my hands from the home row.
The command that is remapped in Tools => Customize => [Keyboard] is shown in parentheses.
I'm 100% positive that there are better remappings than these, so please post yours! Please include the command; oft times, figuring it out is a challenge.
-- Hoytster
Running the app and operating the debugger
Ctrl+Q + Ctrl+R Run the application, in debug mode (Debug.Start)
Ctrl+Q + Ctrl+Q Quit (stop) the application (Debug.StopDebugging)
Ctrl+T Toggle a breakpoint at the current line (Debug.ToggleBreakpoint)
Ctrl+K + Ctrl+I Step Into the method (Debug.StepInto)
Ctrl+K + Ctrl+O Step Out of the method (Debug.StepOut)
Ctrl+N Step over the method to the Next statement (Debug.StepOver)
Ctrl+K + Ctrl+H Run the code, stopping Here at the cursor position (Debug.RunToCursor)
Ctrl+K + Ctrl+E Set then next statement to Execute (Debug.SetNextStatement)
Navigating the code
Ctrl+S Move a character LEFT (Edit.CharLeft)
Ctrl+D Move a character RIGHT (Edit.CharRight)
Ctrl+Q + Ctrl+S Move to the LEFT END of the current line (Edit.LineStart)
Ctrl+Q + Ctrl+D Move to the RIGHT END of the current line (Edit.LineEnd)
Ctrl+E Move a line UP (Edit.LineUp)
Ctrl+X Move a line DOWN (Edit.LineDown)
Ctrl+K + Ctrl+K Toggle (add or remove) bookmark (Edit.ToggleBookmark)
Ctrl+K + Ctrl+N Move to the NEXT bookmark (Edit.NextBookmark)
Ctrl+K + Ctrl+P Move to the PREVIOUS bookmark (Edit.PreviousBookmark)
Ctrl+Q + Ctrl+W Save all modified Windows (File.SaveAll)
Ctrl+L Find the NEXT instance of the search string (Edit.FindNext)
Ctrl+K + Ctrl+L Find the PREVIOUS instance of the search string (Edit.FindPrevious)
Ctrl+Q + Ctrl+L Drop down the list of open files (Window.ShowEzMDIFileList)
The last sequence is like clicking the downward-facing triangle in the upper-right corner of the code editor window. VS will display a list of all the open windows. You can select from the list by typing the file name; the matching file will be selected as you type. Pause for a second and resume typing, and the matching process starts over, so you can select a different file. Nice, VS Team. The key takes you to the tab for the selected file.
OK, it's a community wiki; edit away. :)
Tools -> Options -> Keyboard -> Apply the following additional keyboard mapping scheme -> Emacs
For editing and rearranging I've found the following 3 very useful, even though they're not on the home row:
Keypad + for Edit.Copy
Keypad - for Edit.Cut
Keypad * for Edit.Paste
These are easy to hit (even with the right thumb, at a pinch, if your right hand is holding the mouse) and require no meta keys. I often work by writing snippets then turning it into compilable code using search and replace, and then copying in words from elsewhere. The second step is usually most efficiently done by using the cursor with the mouse, so I've not found it a problem that these keys are so far away from the typing set -- being able to hit them without meta keys is more important.
(For commenting out large swathes of code, the above makes it impossible to use the numeric keypad to quickly add in /* or */. I've taken to using Edit.CommentSelection and Edit.UncommentSelection instead, or Visual Assist's comment selection facility. These have the additional slight advantage of not producing unnestable comments.)
Only other particularly useful shortcuts I find myself stuck without are these two:
Ctrl+Alt+1 for View.FindResults1
Ctrl+Alt+2 for View.FindResults2
The other lesser windows have keyboard shortcuts for them by default; I'm not sure why the Find Results windows don't.
I don't generally remap much (probably due to having to wander around and help others who have default mappings often), but there are two additions / changes I like to make:
Alt+N becomes VAssistX -> Refactor -> Rename... for Visual Assist X (VAssistX.RefactorRename). More recent VAX copies make this Shift+Alt+R automatically, but we were on a version without a keybinding for this, and I became accustomed to Alt+N.
F7 changes to do a Build -> Project Only -> Build Only Project (Build.BuildOnlyProject); Ctrl+Shift+B still builds the solution. Not sure if I'm married to this or not, but I do wish there was a default keyboard shortcut for BuildOnlyProject. Since we're using an external make, Ctrl+F7 (Build.Compile) for a single file doesn't work for us, and I forget it exists half the time when working with other projects.
If you'll allow me to continue to gush over a commercial product, my favorite shortcuts are still VAX's Alt+Shift+S find symbol, Alt+Shift+O open file in solution, and Alt+O open corresponding file. But those are not remappings, they're defaults...
Ctrl+1 - Resharper.UnitTest_ContextRun (Run unit test at cursor position)
Ctrl+2 - Resharper.UnitTest_ContextDebug (Debug unit test at cursor position)
http://www.viemu.com/
It tries very hard to accurately emulate vim. Intellisense and all other features of VS still work perfectly (unlike with all the free vi[m] plugins).
The developer is very friendly and has a very fast turnaround time for feature requests.
I can't use VS without this plugin as a long long time vim user.
ALT+W+U : Hide all tool windows like Watch, Immediate, Output etc. Useful when you wanna focus on the code you're writing

Resources