简体   繁体   中英

VSCode Remap keyboard shortcut

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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM