2

I have been trying for awhile now to remap the Ctrl+Tab and Ctrl+Shift+Tab keys to switch editor tabs linearly. (Like they would in Chrome)

I have learned that by default, the Ctrl+PgUp and Ctrl+PgDown keys have the functionality I desire. However, whether it be through the graphical Keyboard Shortcut page or the keybindings.json file, I cannot get the keys to do what I want them to.

Relevant parts of keybindings.json:

{
  "key": "ctrl+pagedown",
  "command": "-selectNextPageSuggestion"
},
{
  "key": "ctrl+pageup",
  "command": "-selectPrevPageSuggestion"
},
{
  "key": "ctrl+tab",
  "command": "-workbench.action.openNextRecentlyUsedEditorInGroup"
},
{
  "key": "ctrl+shift+tab",
  "command": "-workbench.action.openPreviousRecentlyUsedEditorInGroup"
},
{
  "key": "ctrl+tab",
  "command": "selectNextPageSuggestion"
},
{
  "key": "ctrl+shift+tab",
  "command": "selectPrevPageSuggestion"
}

Theoretically, I believe that this should work, but it only disables the Ctrl+Tab and Ctrl+Shift+Tab keys entirely, and doesn't give them the Ctrl+PgUp and Ctrl+PgDown behavior that I am after.

Any help is appreciated.

1 Answer 1

4

Your code seems overly complicated. I just put the following into my keybindings.json file and it is working perfectly:

{ "key": "ctrl+tab",         "command": "workbench.action.nextEditor" },
{ "key": "ctrl+shift+tab",   "command": "workbench.action.previousEditor" },

It doesn't disable Ctrl+PgUp and Ctrl+PgDown but does add the new functionality you desire.

3
  • Thanks, I don't know why I didn't come across those commands earlier.
    – ifconfig
    Commented Sep 26, 2017 at 2:57
  • I just searched for ctrl+pagedown and ctrl+pageup in the default keybindings. Open the Keyboard shortcuts from the gear icon and click on the easy to miss keybindings.json link at the top which should open a split panel with the default keybindings on top and your overrides underneath. Then I searched for those key sequences and copied what you wanted into my override file below and gave them the keystrokes you wanted.
    – Mark
    Commented Sep 26, 2017 at 3:03
  • Ah, Yes. My search function was throwing me off. I see it now.
    – ifconfig
    Commented Sep 26, 2017 at 3:08

Not the answer you're looking for? Browse other questions tagged or ask your own question.