<p>Is it possible to change how <kbd>Ctrl</kbd> + <kbd>Tab</kbd> and <kbd>Shift</kbd> + <kbd>Ctrl</kbd> + <kbd>Tab</kbd> 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.</p>

<p>Every other program that uses a tab control for open document I have seen uses <kbd>Ctrl</kbd> + <kbd>Tab</kbd> to move from left to right and <kbd>Shift</kbd> + <kbd>Ctrl</kbd> + <kbd>Tab</kbd> 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. </p>

<p>It is very counterintuitive. Is this a subtle way to encourage everyone to only ever have two document open at once?</p>

<hr>

<p>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, <kbd>Ctrl</kbd> + <kbd>Tab</kbd> 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. </p>

<p>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.</p>

[{'answer_id': 21092, 'author': 'PabloG', 'author_id': 394, 'author_profile': 'https://Stackoverflow.com/users/394', 'pm_score': -1, 'selected': False, 'text': '<p>I don\'t use Visual Studio (<em>yes, really, I don\'t use it</em>), but <a href="http://en.wikipedia.org/wiki/AutoHotkey" rel="nofollow noreferrer">AutoHotkey</a> can remap any hotkey globally or in a particular application:</p>\n\n<pre><code>#IfWinActive Microsoft Excel (application specific remapping)\n\n; Printing area in Excel (@ Ctrl+Alt+A)\n^!a::\nSend !ade\nreturn\n\n#IfWinActive\n\n\n$f4::\n; Closes the active window (make double tapping F4 works like ALT+F4)\nif f4_cnt &gt; 0 \n{\n    f4_cnt += 1\n    return\n}\n\nf4_cnt = 1\nSetTimer, f4_Handler, 250\nreturn\n\nf4_Handler:\nSetTimer, f4_Handler, off\n\nif (f4_cnt &gt;= 2)    ; Pressed more than two times\n{   \n    SendInput !{f4}\n} else {\n    ; Resend f4 to the application\n    Send {f4}\n}\n\nf4_cnt = 0\nreturn\n</code></pre>\n\n<p>These are two remappings of my main AutoHotKey script. I think it\'s an excellent tool for this type of tasks.</p>\n'}, {'answer_id': 36569, 'author': 'buti-oxa', 'author_id': 2515, 'author_profile': 'https://Stackoverflow.com/users/2515', 'pm_score': 3, 'selected': False, 'text': "<p>I guess you want what VSS calls Next(Previous)DocumentWindow. By default, it's on <KBD>Ctrl(-Shift)-F6</KBD> on my VSS 8. On <KBD>Ctrl(-Shift)-Tab</KBD> they have <code>Next(Previous)DocumentWindowNav</code>. You can change key assignments via Tools/Options/Keyboard.</p>\n"}, {'answer_id': 852050, 'author': 'Community', 'author_id': -1, 'author_profile': 'https://Stackoverflow.com/users/-1', 'pm_score': 3, 'selected': False, 'text': '<p>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 <strong>completely useless</strong>.</p>\n\n<p>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.</p>\n\n<p>That way you will also find the DocumentWindowNav more useful!</p>\n'}, {'answer_id': 1023039, 'author': 'Kei', 'author_id': 126348, 'author_profile': 'https://Stackoverflow.com/users/126348', 'pm_score': 3, 'selected': False, 'text': '<p>I\'m 100% in agreement with Jeff.</p>\n\n<p>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 <kbd>Ctrl</kbd>-<kbd>Tab</kbd>.  As Jeff said, "<em>The current tab behavior keeps pulling me out of the task and makes me have to pay attention to the tool</em> " 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.</p>\n\n<p>I think <kbd>Ctrl</kbd>-<kbd>F6</kbd> - 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.</p>\n\n<p>With this taken this into account, I usually use <kbd>Ctrl</kbd>+<kbd>F6</kbd> 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 <kbd>Ctrl</kbd>+<kbd>F6</kbd> and release keys, I\'ll jump to Tab1. Pressing <kbd>Ctrl</kbd>+<kbd>F6</kbd> again will take me back to Tab2.</p>\n'}, {'answer_id': 1475859, 'author': 'user178908', 'author_id': 178908, 'author_profile': 'https://Stackoverflow.com/users/178908', 'pm_score': 3, 'selected': False, 'text': '<p>Navigate to the blog post <em><a href="http://www.mrspeaker.net/2006/10/12/tab-un-stupidifier/" rel="nofollow noreferrer">Visual Studio Tab Un-stupidifier Macro</a></em> 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. </p>\n'}, {'answer_id': 3401858, 'author': 'user410261', 'author_id': 410261, 'author_profile': 'https://Stackoverflow.com/users/410261', 'pm_score': 3, 'selected': False, 'text': '<p>After a couple of hours of searching I found a solution how to switch between open documents using <kbd>CTRL</kbd>+<kbd>TAB</kbd> which move from left to right and  <kbd>SHIFT</kbd>+ <kbd>CTRL</kbd>+ <kbd>TAB</kbd> to go right to left. </p>\n\n<p>In short you need to copy and paste this macro:</p>\n\n<pre><code>Imports System\nImports EnvDTE\nImports EnvDTE80\nImports EnvDTE90\nImports System.Diagnostics\n\nPublic Module TabCtrl\n\nPublic Sub TabForward()\n    Dim i As Integer\n    Dim activateNext As Boolean = False\n\n    For i = 1 To DTE.Windows.Count\n        If DTE.Windows().Item(i).Kind = "Document" Then\n\n            If activateNext Then\n                DTE.Windows().Item(i).Activate()\n                GoTo done\n            End If\n\n            If DTE.Windows().Item(i) Is DTE.ActiveWindow Then\n                activateNext = True\n            End If\n        End If\n    Next\n\n    \' Was the last window... go back to the first\n    If activateNext Then\n        For i = 1 To DTE.Windows.Count\n            If DTE.Windows().Item(i).Kind = "Document" Then\n                DTE.Windows().Item(i).Activate()\n                GoTo done\n            End If\n        Next\n    End If\ndone:\n\nEnd Sub\n\nPublic Sub TabBackward()\n    Dim i As Integer\n    Dim activateNext As Boolean = False\n\n    For i = DTE.Windows.Count To 1 Step -1\n        If DTE.Windows().Item(i).Kind = "Document" Then\n\n            If activateNext Then\n                DTE.Windows().Item(i).Activate()\n                GoTo done\n            End If\n\n            If DTE.Windows().Item(i) Is DTE.ActiveWindow Then\n                activateNext = True\n            End If\n        End If\n    Next\n\n    \' Was the first window... go back to the last\n    If activateNext Then\n        For i = DTE.Windows.Count To 1 Step -1\n            If DTE.Windows().Item(i).Kind = "Document" Then\n                DTE.Windows().Item(i).Activate()\n                GoTo done\n            End If\n        Next\n    End If\ndone:\n\nEnd Sub\n\nEnd Module\n</code></pre>\n\n<p>The macro comes from: www.mrspeaker.net/2006/10/12/tab-un-stupidifier/</p>\n\n<p>If you never add a macro to Visual Studio there is a very useful link how to <a href="http://www.switchonthecode.com/tutorials/how-to-configure-and-use-visual-studio-macros" rel="nofollow noreferrer">do it</a>.</p>\n'}, {'answer_id': 4099033, 'author': 'thepaulpage', 'author_id': 1161710, 'author_profile': 'https://Stackoverflow.com/users/1161710', 'pm_score': 8, 'selected': False, 'text': '<p>In Visual Studio 2015 (as well as previous versions of VS, but you must install <a href="https://visualstudiogallery.msdn.microsoft.com/dbcb8670-889e-4a54-a226-a48a15e4cace">Productivity Power Tools</a> if you\'re using VS2013 or below), there are two new commands in Visual Studio:</p>\n\n<p><em>Window.NextTab</em> and \n<em>Window.PreviousTab</em> </p>\n\n<p>Just go remap them from <kbd>Ctrl</kbd>+<kbd>Alt</kbd>+<kbd>PageUp</kbd>/<kbd>Ctrl</kbd>+<kbd>Alt</kbd>+<kbd>PageDown</kbd> to <kbd>Ctrl</kbd>+<kbd>Tab</kbd>/<kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>Tab</kbd> in:</p>\n\n<p>Menu <em>Tools</em> -> <em>Options</em> -> <em>Environment</em> -> <em>Keyboard</em></p>\n\n<p>Note: In earlier versions such as Visual Studio 2010, Window.NextTab and Window.PreviousTab were named <em>Window.NextDocumentWellTab</em> and \n<em>Window.PreviousDocumentWellTab</em>.</p>\n'}, {'answer_id': 6923304, 'author': 'riffraff', 'author_id': 876135, 'author_profile': 'https://Stackoverflow.com/users/876135', 'pm_score': 2, 'selected': False, 'text': '<p>In registry branch:\nHKEY_CURRENT_USER\\Software\\Microsoft\\VisualStudio\\9.0\nadd DWORD named "UseMRUDocOrdering" with value of 1.\nIt will order documents so most recently used are placed on the left. It\'s not perfect but better than the default misbehaviour.</p>\n'}, {'answer_id': 10339707, 'author': 'Zoey', 'author_id': 871086, 'author_profile': 'https://Stackoverflow.com/users/871086', 'pm_score': 6, 'selected': False, 'text': '<p>Visual Studio 2010 has, built in, a way to solve this.</p>\n\n<p>By default, <kbd>Ctrl</kbd>+<kbd>Tab</kbd> and <kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>Tab</kbd> are assigned to <code>Window.[Previous/Next]..Document</code>, but you can, through </p>\n\n<pre><code>Tools -&gt; Options -&gt; Environment -&gt; Keyboard,\n</code></pre>\n\n<p>remove those key assignments and reassign them to <code>Window.[Next/Previous]Tab</code> to add the desired behavior.</p>\n'}, {'answer_id': 15753497, 'author': 'nawfal', 'author_id': 661933, 'author_profile': 'https://Stackoverflow.com/users/661933', 'pm_score': 6, 'selected': False, 'text': '<p>it can be changed, at least in VS 2012 (I think it should work for 2010 too).</p>\n\n<p>1) <code>TOOLS &gt; Options &gt; Environment &gt; Keyboard</code></p>\n\n<p>(Yes TOOLS, its VS2012 !) Now three shortcuts to check.</p>\n\n<p>2) <code>Window.NextDocumentWindow</code> - you can reach there quickly by typing on the search pane on top. Now this is your <em>enemy</em>. Remove it if you dont like it. Change it to something else (and dont forget the <strong>Assign</strong> button) if want to have your own, <strong>but do remember that shortcut whatever it is in the end</strong>. It will come handy later.</p>\n\n<p>(I mean this is the shortcut that remembers your last tab)</p>\n\n<p><img src="https://i.stack.imgur.com/GYO0E.png" alt="enter image description here"></p>\n\n<p>3) Now look for <code>Window.NextDocumentWindowNav</code> - 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 <strong>remember</strong>).</p>\n\n<p>4) <code>Window.NextTab</code> - your magic potion. This would let you cycle through tabs in the forward order. May be you want <kbd>CTRL</kbd>+<kbd>TAB</kbd>? Again step 2 and <strong>remember</strong>.</p>\n\n<p>5) Now place cursor in the <em>Press shortcut keys:</em> textbox (doesn\'t matter what is selected currently, you\'re not going to <em>Assign</em> this time), and type first of the three (or two or one) shortcuts. </p>\n\n<p><img src="https://i.stack.imgur.com/PRiW9.png" alt="enter image description here"></p>\n\n<p>You\'ll see <em>Shortcut currently used by:</em> 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.</p>\n\n<p>6) Now repeat 1-5 for <code>Previous</code> shortcuts as well (preferably adding <kbd>Shift</kbd>).</p>\n\n<p>7) Bonus: Select VS2005 mapping scheme (at the top of the same box), so now you get <kbd>F2</kbd> for <em>Rename</em> members and not <kbd>CTRL</kbd>+<kbd>R</kbd>+<kbd>R</kbd>, and <kbd>F7</kbd> for <em>View Code</em> and not <kbd>CTRL</kbd>+<kbd>ALT</kbd>+<kbd>0</kbd>.</p>\n\n<p><em>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 <kbd>ALT</kbd>+<kbd>TAB</kbd>). My browser does the same too by default (Opera), though I know Firefox behaves differently.</em></p>\n'}, {'answer_id': 15759819, 'author': 'Colonel Panic', 'author_id': 284795, 'author_profile': 'https://Stackoverflow.com/users/284795', 'pm_score': 4, 'selected': False, 'text': '<p>In Visual Studio 2012 or later (2013, 2015, 2017...):</p>\n\n<ol>\n<li>Browse the menu Tools / Options / Environment / Keyboard.</li>\n<li>Search for the command \'Window.NextTab\', set the shortcut to <kbd>Ctrl</kbd>+<kbd>Tab</kbd></li>\n<li>Search for the command \'Window.PreviousTab\', set the shortcut to <kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>Tab</kbd></li>\n</ol>\n\n<p><img src="https://i.stack.imgur.com/8WKmE.png" alt="enter image description here"></p>\n'}, {'answer_id': 31553843, 'author': 'FlashJordan', 'author_id': 4171724, 'author_profile': 'https://Stackoverflow.com/users/4171724', 'pm_score': 3, 'selected': False, 'text': '<p><kbd>Ctl</kbd> + <kbd>Alt</kbd> + <kbd>PgUp</kbd> or <kbd>PgDn</kbd> shortcuts worked to toggle next/prev tab out of the box for me...</p>\n'}, {'answer_id': 62254279, 'author': 'JWCS', 'author_id': 6069586, 'author_profile': 'https://Stackoverflow.com/users/6069586', 'pm_score': 0, 'selected': False, 'text': '<p>Updated to VS 2017+, where, according to <a href="https://stackoverflow.com/questions/21027/changing-ctrl-tab-behavior-for-moving-between-documents-in-visual-studio#comment78471811_4099033">@J-Bob\'s comment</a> under @thepaulpage\'s answer, (emphasis added):</p>\n\n<blockquote>\n  <p>Looks like the commands have changed again. It\'s now 2017 and the keyboard shortcuts are called <strong>Open Next Editor</strong> and <strong>Open Previous Editor</strong>. You don\'t need any extensions for this. </p>\n</blockquote>\n\n<p>You can find the options under Settings, which can be accessed via the gear symbol in the lower left, or by the <code>[Ctrl]+,</code> command.</p>\n'}, {'answer_id': 67597320, 'author': 'joepcash', 'author_id': 13151199, 'author_profile': 'https://Stackoverflow.com/users/13151199', 'pm_score': -1, 'selected': True, 'text': "<p>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:</p>\n<ol>\n<li>Click the gear icon in the bottom-left.</li>\n<li>Select 'Keyboard Shortcuts'.</li>\n<li>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.</li>\n</ol>\n<p>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.</p>\n"}]
['https://Stackoverflow.com/questions/21027', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/2277/']