VSCode Remap keyboard shortcut

让人想犯罪 __ 提交于 2019-12-10 22:22:53

问题


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:


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.



来源:https://stackoverflow.com/questions/46416552/vscode-remap-keyboard-shortcut

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!