What is the “When” and “Command” for ctrl-P panels?

感情迁移 提交于 2019-12-01 12:40:53

When you click Ctrl-P you are in the file picker, so you need a command that then moves up and down the filepicker. It took a bit because I thought just searching for the UpArrow bindings would make it obvious. But it did not.

Looking again at what Ctrl-P is bound to revealed another command also bound to Ctrl-P : workbench.action.quickOpenNavigateNextInFilePicker so try:

  {
    "key": "alt+i",
    "command": "workbench.action.quickOpenNavigateNextInFilePicker",
    "when": "inFilesPicker && inQuickOpen"
  },
  {
    "key": "ctrl+p",
    "command": "-workbench.action.quickOpenNavigateNextInFilePicker",
    "when": "inFilesPicker && inQuickOpen"
  },
  {
    "key": "alt+j",
    "command": "workbench.action.quickOpenNavigatePreviousInFilePicker",
    "when": "inFilesPicker && inQuickOpen"
  },
  {
    "key": "ctrl+shift+p",
    "command": "-workbench.action.quickOpenNavigatePreviousInFilePicker",
    "when": "inFilesPicker && inQuickOpen"
  }

Now choosing Alt-I and Alt-J just happens to avoid the usual Alt key trigger of the menu bar opening items, like Alt-D will open the Debug menu. If you have a conflicting Alt-Something that you wanted to use, you can disable the menu bar Alt behavior with:

// If enabled, the main menus can be opened via Alt-key shortcuts. Disabling mnemonics allows to bind these Alt-key shortcuts to editor commands instead.

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