Keymaps not working

In the theia browser example, I added keymaps.json file for custom keybinding to provide VS Code like new file keybinding (crtlcmd+n)
Path of keymaps.json => theia/examples/browser/keymaps.json

[
  {
    "command": "file.newFile",
    "keybinding": "ctrlcmd+n"
  },
  {
    "command": "file-search.openFile",
    "keybinding": "ctrlcmd+n"
  }
]

Post these changes, I ran the following command
yarn && yarn start:browser
The keybindings are not reflected. I pressed ctrlcmd+n new tab is opened instead of a new file


Does anyone has a fix for this?

@vinayb21 it looks like the path to your keymaps.json file is incorrect. The file is generally located under your user’s home at ~/.theia/keymaps.json. In addition, the updated keybindings look incorrect as you are not removing the old binding. Using the Keyboard Shortcuts view my result is:

[
    {
        "command": "file.newFile",
        "keybinding": "ctrlcmd+a"
    },
    {
        "command": "-file.newFile",
        "keybinding": "ctrlcmd+n"
    }
]

If you’re having difficulties, you can use the Keyboard Shortcuts view to properly create, manage and update keybindings.

1 Like