Vim: How to map <leader>t to CMD+P (mac)

Created on 19 Apr 2018  路  5Comments  路  Source: VSCodeVim/Vim

I want to open the file picker when I hit <leader>t.

Leader is mapped:
"vim.leader": ","

VS Code default mapping for the command in question:
{
"key": "cmd+p",
"command": "workbench.action.quickOpenNavigateNextInFilePicker",
"when": "inFilesPicker && inQuickOpen"
}

What should be my config?

I have tried the following and few other combination and I can't get it to work.

  "vim.otherModesKeyBindings": [
    // file picker
    {
      "before": ["<leader>", "t"],
      "after": ["cmd+p"]
    }
  ]

Please let me know if this is even possible.

kinquestion

Most helpful comment

This works for me:

        {
            "before": [
                "<leader>",
                "t"
            ],
            "after": [],
            "commands": [
                {
                    "command": "workbench.action.quickOpen",
                    "args": []
                }
            ]
        }

As far as I understand, the workbench.action.quickOpenNavigateNextInFilePicker is used to navigate to the next entry once the quick open pane is opened. The workbench.action.quickOpen can be used to open it.

All 5 comments

it is. don't map to vscode keybindinga but to commands. there is some examples of this in the readme

I have tried that also, and it doesn't work for me.

    // file picker
    {
      "before": ["<leader>", "t"],
      "after": [],
      "commands": [
        {
          "command": "workbench.action.quickOpenNavigateNextInFilePicker"
        }
      ]
    }

This works for me:

        {
            "before": [
                "<leader>",
                "t"
            ],
            "after": [],
            "commands": [
                {
                    "command": "workbench.action.quickOpen",
                    "args": []
                }
            ]
        }

As far as I understand, the workbench.action.quickOpenNavigateNextInFilePicker is used to navigate to the next entry once the quick open pane is opened. The workbench.action.quickOpen can be used to open it.

馃憤 This worked for me too. FYI, I had to restart vsc to get it to pick up the change.

This works for me as well. Thank you for the suggestions. I just wish these shortcuts also worked without having to open a file (global in vscode).

Was this page helpful?
0 / 5 - 0 ratings

Related issues

liamdawson picture liamdawson  路  3Comments

ACollectionOfAtoms picture ACollectionOfAtoms  路  3Comments

triztian picture triztian  路  3Comments

jaredly picture jaredly  路  3Comments

waltiam picture waltiam  路  3Comments