Unable to set a hotkey to F1

I’d like to set the “Open Quick Switcher” hotkey to the “F1” key to mirror the same hotkey in VS Code.

Steps to reproduce

Using the settings interface;

  1. Click the “Customise this command” button
  2. Press the “F1” key

Expected result

The “F1” key should become the hotkey for “open Quick Switcher”.

Actual result

Nothing changes in the UI or the settings file.

Environment

  • Operating system:
    macOS Catalina

  • Obsidian version:
    latest at time of writing; 0.9.3


Additional information

Discord user htuy tried setting the value in the .config file but it changed the UI but didn’t affect the hotkeys.

Love your work everyone!

1 Like

I think f1 opens the help vault by default, which might be causing conflicts. Not sure if there’s a way to work around it though

I use following workaround to create hotkeys without modifier keys.
I used similar procedure to set one-key hotkeys in TheBrain previously.
It requires manually editing “config” file so be careful .
I have the config file located in “MyObsidianVaultFolder/.obsidian”.

  1. Locate “config” file and make a backup copy for safety in case of editing error.
  2. In Obsidian in hotkey settings, set e.g. “Ctrl+F1” to “Open quick switcher” command.
    This will create following record in “config” file:
    (Edit 2021-01-06: JSON in “config” is changed to single line so adjust the whitespace accordingly when searching.)
    "switcher:open": [
      {
        "modifiers": [
          "Mod"
        ],
        "key": "F1"
      }
  1. Open original “config” file in text editor, e.g. notepad.
  2. Use Ctrl+F to Search for “F1” in order to locate record specified above.
  3. In that record, delete line:
          "Mod"

to get

    "switcher:open": [
      {
        "modifiers": [
        ],
        "key": "F1"
      }
  1. Save changes in “config” file.
  2. Reload Obsidian
  3. Press “F1” to open quick switcher.
  4. Done.

Also alphabetic keys can be set as hotkeys but unfortunately, they are incompatible with writing because, unlike in TheBrain, they are not deactivated when active pane is in edit mode.
I might request that when more important functionality is implemented. In TheBrain it effectively reduced number of key-presses needed for navigation for less than half.

5 Likes

Here is request to directly/officially support fast one-key hotkeys (without modifiers): Single key shortcuts (context sensitive)

For any one else looking to achive something like this, this method worked great, thanks @malecjan

Thanks a bundle, @malecjan, for finding that out—saved my day!

Voted for your FR, too. At least F-keys should be supported w/o modifiers.

Thank you so much for this tutorial. I’m going to try this out right now. Just one question: will future updates wipe this config file and we will need to redo it, or should we be on the lookout for any issues with future updates?

Seems that there’s no config file anymore. There’s a “hotkeys.json” one though, but it gets overridden on each startup.