Search code examples
visual-studio-codesublimetext3key-bindings

VSCode key binding for next editor in stack


In Sublime I have a keybinding set up like so:

{ "keys": ["super+j"], "command": "next_view_in_stack" },

I am trying to recreate this behavior in VSCode with

{
    "key":"cmd+j",
    "command":"workbench.action.previousEditor"
},

but instead of going to my previous tab, it goes one tab to the left. Is there any concept of a "stack" of editors like in Sublime?


Solution

  • You need to configure two different key bindings to get this working correctly.

    First configure workbench.action.quickOpenPreviousRecentlyUsedEditorInGroup to Cmd + J, and set its when expression to !inQuickOpen.

    Also, to allow using the shortcut repeatedly once the quick open list is already open, you need to also configure workbench.action.quickOpenNavigateNext to Cmd + J, and set its when expression to inQuickOpen.

    For me this worked when I wanted to configure Alt + Tab for the recent file cycling shortcut. Hope this helps.