Favorite Visual Studio keyboard remappings? [closed] - visual-studio

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

Related

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+→

What Xcode keyboard shortcuts do you use regularly? [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 10 years ago.
What Xcode keyboard shortcuts do you use regularly?
I am a huge believer in using the keyboard as much as possible (its much faster that way), and I was hoping others could share some of the Xcode shortcuts they use.
I find the shortcuts to open & close various areas of the screen must useful.
Cmd + Shift + o opens the "Open quickly" dialog, where you can quickly find and open files that contain the text you enter.
Updated for newer versions:
Control + Command + ↑
Switches between corresponding .h / .m files or as Apple's own documentation, it means Jump to Counterpart
command + shift + j
Reveals the current file in the project navigator. Very useful if you use command + control + J to jump to a definition as Xcode won't automatically reveal the containing file in the navigator.
command /
Comment out the current line, or multiple lines if they're highlighted.
Comes in handy for quick commenting and uncommenting while experimenting with code.
Re-indent. It's in Edit > Format > Re-Indent and there's no shortcut by default (I use Command + Shift + L). It's a godsend.
command F Search in the File
option command F Search & Replace in the File
shift command F Search in the whole project
shift option command F Search & Replace in the whole project
Notice the pattern for easy memorizing.
Ctrl + Command + ↑ - Switch between header and implementation files.
Command + J
(Move focus to any section of the editor)
Control + Command + j
Highlight a keyword (method name) and jump to its definition. Also works for variables, #defines, etc.
Some of my favorite shortcuts are not keyboard shortcuts at all, but multitouch gestures. All Macbooks from early 2008 onward, and I would imagine desktops with a Magic Mouse or Magic Trackpad, support three-finger-swipe up and down to switch between the header and implementation, and three-finger-swipe left and right to navigate within the file history.
Command + Shift + Y for the console.
I find a cheat sheet next to the computer is the best way to pick up useful shortcuts. Cocoa Samurai has a good one.
Key Bindings to XCode Actions
Create your own keyboard shortcuts using the Text Key Bindings tab of the Key Bindings preference pane. A time-saver all its own. Just lookup your favourite actions and add/edit shortcuts!
Another thread you may find useful is here.
Just the basic emacs navigation. Feels so right.
I cannot live without three finger vertical swipe to switch between interface and implementation file. If you miss that in xcode-4/Lion, make sure to follow the following instructions:
http://geeksinkilts.com/?p=67

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

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.

Hidden Features of Visual Studio (2005-2010)?

Locked. This question and its answers are locked because the question is off-topic but has historical significance. It is not currently accepting new answers or interactions.
Visual Studio is such a massively big product that even after years of working with it I sometimes stumble upon a new/better way to do things or things I didn't even know were possible.
For instance-
Crtl + R, Ctrl + W to show white spaces. Essential for editing Python build scripts.
Under "HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\8.0\Text Editor"
Create a String called Guides with the value "RGB(255,0,0), 80" to have a red line at column 80 in the text editor.
What other hidden features have you stumbled upon?
Make a selection with ALT pressed - selects a square of text instead of whole lines.
Tracepoints!
Put a breakpoint on a line of code. Bring up the Breakpoints Window and right click on the new breakpoint. Select 'When Hit...'. By ticking the 'Print a message' check box Visual Studio will print out a message to the Debug Output every time the line of code is executed, rather than (or as well as) breaking on it. You can also get it to execute a macro as it passes the line.
You can drag code to the ToolBox. Try it!
Click an identifier (class name, variable, etc) then hit F12 for "Go To Definition". I'm always amazed how many people I watch code use the slower right-click -> "Go To Definition" method.
EDIT: Then you can use Ctrl+- to jump back to where you were.
CTRL+SHIFT+V will cycle through your clipboard, Visual Studio keeps a history of copies.
Sara Ford covers lots of lovely tips: http://blogs.msdn.com/saraford/archive/tags/Visual+Studio+2008+Tip+of+the+Day/default.aspx
But some of my favourites are Code Snippets, Ctrl + . to add a using <Namespace> or generate a method stub.
I can't live without that.
Check out a great list in the Visual Studio 2008 C# Keybinding poster: http://www.microsoft.com/downloadS/details.aspx?familyid=E5F902A8-5BB5-4CC6-907E-472809749973&displaylang=en
CTRL-K, CTRL-D
Reformat Document!
This is under the VB keybindings, not sure about C#
How many times do you debug an array in a quickwatch or a watch window and only have visual studio show you the first element? Add ",N" to the end of the definition to make studio show you the next N items as well. IE "this->m_myArray" becomes "this->m_array,5".
Incremental search: While having a source document open hit (CTRL + I) and type the word you are searching for you can hit (CTRL + I) again to see words matching your input.
You can use the following codes in the watch window.
#err - display last error
#err,hr - display last error as an HRESULT
#exception - display current exception
Ctrl-K, Ctrl-C to comment a block of text with // at the start
Ctrl-K, Ctrl-U to uncomment a block of text with // at the start
Can't live without it! :)
Stopping the debugger from stepping into trivial functions.
When you’re stepping through code in the debugger, you can spend a lot of time stepping in and out of functions you’re not particularly interested in, with names such as GetID(), or std::vector<>(), to pick a C++ example. You can use the registry to make the debugger ignore these.
For Visual Studio 2005, you have to go to HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio \8.0\NativeDE\StepOver and add string values containing regular expressions for each function or set of functions you wish to exclude; e.g.
std::vector.*::.*
TextBox::GetID
You can also override these for individual exceptions. For instance, suppose you did want to step into the vector class’s destructor:
std::vector.*::\~.*=StepInto
You can find details for other versions of Visual Studio at http://blogs.msdn.com/andypennell/archive/2004/02/06/69004.aspx
Ctrl-F10: run to cursor during debugging. Took me ages to find this, and I use it all the time;
Ctrl-E, Ctrl-D: apply standard formatting (which you can define).
TAB key feature.
If you know snippet key name, write and click double Tab. for example:
Write
foreach
and then click tab key twice to
foreach (object var in collection_to_loop)
{
}
2. If you write any event, write here
Button btn = new Button();
btn.Click +=
and then click tab key twice to
private void Form1_Load(object sender, EventArgs e)
{
Button btn = new Button();
btn.Click += new EventHandler(btn_Click);
}
void btn_Click(object sender, EventArgs e)
{
throw new Exception("The method or operation is not implemented.");
}
btn_Click function write automatically
in XAML Editor, Write any event. for example:
MouseLeftButtonDown then click tab
MouseLeftButtonDown="" then click tab again
MouseLeftButtonDown="Button_MouseLeftButtonDown" in the code section Button_MouseLeftButtonDown method created.
Sara Ford has this market cornered.
http://blogs.msdn.com/saraford/default.aspx
More Visual Studio tips and tricks than you can shake a stick at.
Some others:
The Visual Studio 2005 and 2008 3-month trial editions are fully-functional, and can be used indefinitely (forever) by setting the system clock back prior to opening VS. Then, when VS is opened, set the system clock forward again so your datetimes aren't screwed up.
But that's really piracy and I can't recommend it, especially when anybody with a .edu address can get a fully-functional Pro version of VS2008 through Microsoft Dreamspark.
You can use Visual Studio to open 3rd-party executables, and browse embedded resources (dialogs, string tables, images, etc) stored within.
Debugging visualizers are not exactly a "hidden" feature but they are somewhat neglected, and super-useful, since in addition to using the provided visualizers you can roll your own for specific data sets.
Debugger's "Set Instruction Pointer" or "Set Next Statement" command.
Conditional breakpoints (as KiwiBastard noted).
You can use Quickwatch etc. to evaluate not only the value of a variable, but runtime expressions around that variable.
T4 (Text Template Transformation Toolkit). T4 is a code generator built right into Visual Studio
Custom IntelliSense dropdown height, for example displaying 50 items instead of the default which is IMO ridiculously small (8).
(To do that, just resize the dropdown next time you see it, and Visual Studio will remember the size you selected next time it opens a dropdown.)
Discovered today:
Ctrl + .
Brings up the context menu for refactoring (then one that's accessible via the underlined last letter of a class/method/property you've just renamed - mouse over for menu or "Ctrl" + ".")
A lot of people don't know or use the debugger to it's fullest - I.E. just use it to stop code, but right click on the red circle and there are a lot more options such as break on condition, run code on break.
Also you can change variable values at runtime using the debugger which is a great feature - saves rerunning code to fix a silly logic error etc.
Line transpose, Shift-Alt-T
Swaps two line (current and next) and moves cursor to the next line. I'm lovin it. I've even written a macro which changed again position by one line, executed line transpose and changed line position again so it all looking like I swapping current line with previous (Reverse line transpose).
Word transpose, Shift-Ctrl-T
When developing C++, Ctrl-F7 compiles the current file only.
Document Outline in the FormsDesigner (CTRL + ALT + T)
Fast control renaming, ordering and more!
To auto-sync current file with Solution Explorer. So don't have to look where the file lives in the project structure
Tools -> Options -> Projects and Solutions -> "Track Active Item in Solution Explorer"
Edit: If this gets too annoying for you then you can use Dan Vanderboom's macro to invoke this feature on demand through a keystroke.
(Note: Taken from the comment below by Jerry).
I'm not sure if it's "hidden", but not many people know about it -- pseudoregisters. Comes very handy when debugging, I've #ERR, hr in my watch window all the time.
Ctrl-Minus, Ctrl-Plus, navigates back and forward where you've been recently (only open files, though).
I don't use it often, but I do love:
ctrl-alt + mouse select
To select in a rectangular block, to 'block' boundaries.
As noted in comments,
alt + mouse select
Does just a plain rectangular block.
Here's something I learned (for C#):
You can move the cursor to the opening curly brace from the closing curly brace by pressing Control + ].
I learned this on an SO topic that's a dupe of this one:
“Hidden Secrets” of the Visual Studio .NET debugger?
CTRL + Shift + U -> Uppercase highlighted section.
CTRL + U -> Lowercase the highlighted section
Great for getting my SQL Statements looking just right when putting them into string queries.
Also useful for code you've found online where EVERYTHING IS IN CAPS.
Middle Mouse Button Click on the editor tab closes the tab.
To display any chunk of data as an n-byte "array", use the following syntax in Visual Studio's QuickWatch window:
variable, n
For example, to view a variable named foo as a 256-byte array, enter the following expression in the QuickWatch window:
foo, 256
This is particularly useful when viewing strings that aren't null-terminated or data that's only accessible via a pointer. You can use Visual Studio's Memory window to achieve a similar result, but using the QuickWatch window is often more convenient for a quick check.

Changing Ctrl + Tab behavior for moving between documents in Visual Studio

Is it possible to change how Ctrl + Tab and Shift + Ctrl + Tab work in Visual Studio? I have disabled the popup navigator window, because I only want to switch between items in the tab control. My problem is the inconsistency of what switching to the next and previous document do.
Every other program that uses a tab control for open document I have seen uses Ctrl + Tab to move from left to right and Shift + Ctrl + Tab to go right to left. Visual Studio breaks this with its jump to the last tab selected. You can never know what document you will end up on, and it is never the same way twice.
It is very counterintuitive. Is this a subtle way to encourage everyone to only ever have two document open at once?
Let's say I have a few files open. I am working in one, and I need to see what is in the next tab to the right. In every other single application on the face of the Earth, Ctrl + Tab will get me there. But in Visual Studio, I have no idea which of the other tabs it will take me to. If I only ever have two documents open, this works great. As soon as you go to three or more, all bets are off as to what tab Visual Studio has decided to send you to.
The problem with this is that I shouldn't have to think about the tool, it should fade into the background, and I should be thinking about the task. The current tab behavior keeps pulling me out of the task and makes me have to pay attention to the tool.
In Visual Studio 2015 (as well as previous versions of VS, but you must install Productivity Power Tools if you're using VS2013 or below), there are two new commands in Visual Studio:
Window.NextTab and
Window.PreviousTab
Just go remap them from Ctrl+Alt+PageUp/Ctrl+Alt+PageDown to Ctrl+Tab/Ctrl+Shift+Tab in:
Menu Tools -> Options -> Environment -> Keyboard
Note: In earlier versions such as Visual Studio 2010, Window.NextTab and Window.PreviousTab were named Window.NextDocumentWellTab and
Window.PreviousDocumentWellTab.
Visual Studio 2010 has, built in, a way to solve this.
By default, Ctrl+Tab and Ctrl+Shift+Tab are assigned to Window.[Previous/Next]..Document, but you can, through
Tools -> Options -> Environment -> Keyboard,
remove those key assignments and reassign them to Window.[Next/Previous]Tab to add the desired behavior.
it can be changed, at least in VS 2012 (I think it should work for 2010 too).
1) TOOLS > Options > Environment > Keyboard
(Yes TOOLS, its VS2012 !) Now three shortcuts to check.
2) Window.NextDocumentWindow - you can reach there quickly by typing on the search pane on top. Now this is your enemy. Remove it if you dont like it. Change it to something else (and dont forget the Assign button) if want to have your own, but do remember that shortcut whatever it is in the end. It will come handy later.
(I mean this is the shortcut that remembers your last tab)
3) Now look for Window.NextDocumentWindowNav - this is the same as above but shows a preview of opened tabs (you can navigate to other windows too quickly with this pop-up). I never found this helpful though. Do all that mentioned in step 2 (don't forget to remember).
4) Window.NextTab - your magic potion. This would let you cycle through tabs in the forward order. May be you want CTRL+TAB? Again step 2 and remember.
5) Now place cursor in the Press shortcut keys: textbox (doesn't matter what is selected currently, you're not going to Assign this time), and type first of the three (or two or one) shortcuts.
You'll see Shortcut currently used by: listed. Ensure that you have no duplicate entry for the shortcut. In the pic, there are no duplicate entries. In case you have (a rarity), say X, then go to X, and remove the shortcut. Repeat this step for other shortcuts as well.
6) Now repeat 1-5 for Previous shortcuts as well (preferably adding Shift).
7) Bonus: Select VS2005 mapping scheme (at the top of the same box), so now you get F2 for Rename members and not CTRL+R+R, and F7 for View Code and not CTRL+ALT+0.
I'm of the opinion VS has got it right by default. I find it extremely useful that VS remembers what I used last, and makes switching easier, much like what the OS itself does (on ALT+TAB). My browser does the same too by default (Opera), though I know Firefox behaves differently.
In Visual Studio 2012 or later (2013, 2015, 2017...):
Browse the menu Tools / Options / Environment / Keyboard.
Search for the command 'Window.NextTab', set the shortcut to Ctrl+Tab
Search for the command 'Window.PreviousTab', set the shortcut to Ctrl+Shift+Tab
Navigate to the blog post Visual Studio Tab Un-stupidifier Macro and make use of the macro. After you apply the macro to your installation of Visual Studio you can bind your favorite keyboard shortcuts to them. Also notice the registry fix in the comments for not displaying the macro balloon since they might get annoying after a while.
Ctl + Alt + PgUp or PgDn shortcuts worked to toggle next/prev tab out of the box for me...
After a couple of hours of searching I found a solution how to switch between open documents using CTRL+TAB which move from left to right and SHIFT+ CTRL+ TAB to go right to left.
In short you need to copy and paste this macro:
Imports System
Imports EnvDTE
Imports EnvDTE80
Imports EnvDTE90
Imports System.Diagnostics
Public Module TabCtrl
Public Sub TabForward()
Dim i As Integer
Dim activateNext As Boolean = False
For i = 1 To DTE.Windows.Count
If DTE.Windows().Item(i).Kind = "Document" Then
If activateNext Then
DTE.Windows().Item(i).Activate()
GoTo done
End If
If DTE.Windows().Item(i) Is DTE.ActiveWindow Then
activateNext = True
End If
End If
Next
' Was the last window... go back to the first
If activateNext Then
For i = 1 To DTE.Windows.Count
If DTE.Windows().Item(i).Kind = "Document" Then
DTE.Windows().Item(i).Activate()
GoTo done
End If
Next
End If
done:
End Sub
Public Sub TabBackward()
Dim i As Integer
Dim activateNext As Boolean = False
For i = DTE.Windows.Count To 1 Step -1
If DTE.Windows().Item(i).Kind = "Document" Then
If activateNext Then
DTE.Windows().Item(i).Activate()
GoTo done
End If
If DTE.Windows().Item(i) Is DTE.ActiveWindow Then
activateNext = True
End If
End If
Next
' Was the first window... go back to the last
If activateNext Then
For i = DTE.Windows.Count To 1 Step -1
If DTE.Windows().Item(i).Kind = "Document" Then
DTE.Windows().Item(i).Activate()
GoTo done
End If
Next
End If
done:
End Sub
End Module
The macro comes from: www.mrspeaker.net/2006/10/12/tab-un-stupidifier/
If you never add a macro to Visual Studio there is a very useful link how to do it.
The philosophy of the Visual Studio tab order is very counterintuitive since the order of the displayed tabs differs from the tab-switching logic, rendering the ordering of the tabs completely useless.
So until a better solution arises, change the window layout (in Environment->General) from tabbed-documents to multiple-documents; it will not change the behaviour, but it reduces the confusion caused by the tabs.
That way you will also find the DocumentWindowNav more useful!
I'm 100% in agreement with Jeff.
I had worked on Borland C++ Builder for several years and one of the features I miss most is the 'correct' document tabbing order with Ctrl-Tab. As Jeff said, "The current tab behavior keeps pulling me out of the task and makes me have to pay attention to the tool " is exactly how I feels about this, and I'm very much surprised by the fact that there aren't many people complaining about this.
I think Ctrl-F6 - NextDocumentWindowNav - navigates documents based on the document's last-activated time. This behavior is a lot like how MDI applications used to behave in old days.
With this taken this into account, I usually use Ctrl+F6 to switch between 2 documents (which is pretty handy in switching between .cpp and .h files when working on c++ project) even when there are more than 2 currently opened documents. For example, if you have 10 documents open (Tab1, Tab2, Tab3, ...., Tab10), I click on Tab1 and then Tab2. When I do Ctrl+F6 and release keys, I'll jump to Tab1. Pressing Ctrl+F6 again will take me back to Tab2.
I guess you want what VSS calls Next(Previous)DocumentWindow. By default, it's on Ctrl(-Shift)-F6 on my VSS 8. On Ctrl(-Shift)-Tab they have Next(Previous)DocumentWindowNav. You can change key assignments via Tools/Options/Keyboard.
In registry branch:
HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\9.0
add DWORD named "UseMRUDocOrdering" with value of 1.
It will order documents so most recently used are placed on the left. It's not perfect but better than the default misbehaviour.
Updated to VS 2017+, where, according to #J-Bob's comment under #thepaulpage's answer, (emphasis added):
Looks like the commands have changed again. It's now 2017 and the keyboard shortcuts are called Open Next Editor and Open Previous Editor. You don't need any extensions for this.
You can find the options under Settings, which can be accessed via the gear symbol in the lower left, or by the [Ctrl]+, command.
I feel the top answer at the moment is outdated. In Visual Studio 2021 (v1.56), you do not need to install any extensions or mess around with any configuration files. You simply need to do the following steps:
Click the gear icon in the bottom-left.
Select 'Keyboard Shortcuts'.
Search for 'workbench.action.previousEditor' and 'workbench.action.nextEditor' and edit their keybindings by clicking the pencil icon on the left side of the row.
If you do change to 'Ctrl+tab' or any other shortcut that is already in use by another command, it will let you know and give you the option to change those. I personally changed them to 'Ctrl+PgUp' and 'Ctrl+PgDn' so it was just a straight swap.
I don't use Visual Studio (yes, really, I don't use it), but AutoHotkey can remap any hotkey globally or in a particular application:
#IfWinActive Microsoft Excel (application specific remapping)
; Printing area in Excel (# Ctrl+Alt+A)
^!a::
Send !ade
return
#IfWinActive
$f4::
; Closes the active window (make double tapping F4 works like ALT+F4)
if f4_cnt > 0
{
f4_cnt += 1
return
}
f4_cnt = 1
SetTimer, f4_Handler, 250
return
f4_Handler:
SetTimer, f4_Handler, off
if (f4_cnt >= 2) ; Pressed more than two times
{
SendInput !{f4}
} else {
; Resend f4 to the application
Send {f4}
}
f4_cnt = 0
return
These are two remappings of my main AutoHotKey script. I think it's an excellent tool for this type of tasks.

Resources