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

前端 未结 13 503
半阙折子戏
半阙折子戏 2020-11-28 17:39

Is it possible to change how Ctrl + Tab and Shift + Ctrl + Tab work in Visual Studio? I have disabled the popup naviga

相关标签:
13条回答
  • 2020-11-28 17:59

    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.

    0 讨论(0)
  • 2020-11-28 18:04

    In Visual Studio 2012 or later (2013, 2015, 2017...):

    1. Browse the menu Tools / Options / Environment / Keyboard.
    2. Search for the command 'Window.NextTab', set the shortcut to Ctrl+Tab
    3. Search for the command 'Window.PreviousTab', set the shortcut to Ctrl+Shift+Tab

    enter image description here

    0 讨论(0)
  • 2020-11-28 18:05

    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!

    0 讨论(0)
  • 2020-11-28 18:07

    Ctl + Alt + PgUp or PgDn shortcuts worked to toggle next/prev tab out of the box for me...

    0 讨论(0)
  • 2020-11-28 18:08

    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)

    enter image description here

    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.

    enter image description here

    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.

    0 讨论(0)
  • 2020-11-28 18:08

    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.

    0 讨论(0)
提交回复
热议问题