Obsidian/Q/If I'm using dotfiles, can I set a global hotkey for Obsidian actions like copy file path and copy link to heading?
If I'm using dotfiles, can I set a global hotkey for Obsidian actions like copy file path and copy link to heading?
My Answer
- for copy link to heading you can use Obsidian/Plugin/Easy Copy with
CMD+OPT+C(my user-defined preference) .obsidian/hotkeys.jsonlets you customize it in dotfiles.- this isn't sufficiently answered yet.
- unclear:
- how to reference a plugin command in a hotkeys.json file
- whether global hotkeys can be registered and managed in a dotfiles repo (see Obsidian/Q/Does Obsidian have a global config location like XDG home for cross-vault defaults, and do vault-local settings override them? )
- unclear:
- for copy link to heading you can use Obsidian/Plugin/Easy Copy with
AI Answer
- Short answer: Yes — two distinct things both go by "global hotkey" here, and dotfiles cover both paths.
1. Managing in-app Obsidian hotkeys via dotfiles
- Obsidian stores all assigned hotkeys in
.obsidian/hotkeys.jsoninside the vault root. You can track this file with chezmoi, GNU Stow, or any symlink-based dotfiles manager. - Format is JSON: each entry maps a command ID to an array of key combos (modifiers + key).
- Caveat: this is vault-local, not global to the OS. These hotkeys only fire when Obsidian is the focused app. If you want the same bindings on every machine, tracking
.obsidian/hotkeys.jsonin your dotfiles repo is the right move. - Example structure:
- Obsidian stores all assigned hotkeys in
2. System-wide (global) hotkeys — fire even when Obsidian is not focused
- obsidian-global-hotkeys plugin (community plugin,
mjessome/obsidian-global-hotkeys) — the most direct option. In its settings panel you enter a system-wide key combo and map it to any Obsidian command ID. The plugin config is stored in.obsidian/plugins/obsidian-global-hotkeys/data.json, which you can also track in dotfiles. - Hammerspoon (
~/.hammerspoon/init.lua) — classic macOS dotfile. Bind a key combo to anhs.urlevent.openURL("obsidian://...")call or to anhs.application.find("Obsidian"):activate()+hs.eventtapsequence. Hammerspoon's Lua config is a first-class dotfile. - Karabiner-Elements (
~/.config/karabiner/karabiner.json) — remap a key to an unused function key (e.g.F18), then pick that up in Hammerspoon or as an Obsidian hotkey. Config is a dotfile. - Raycast / Alfred — quicklinks using
obsidian://URIs; Raycast dotfiles viaraycast export.
- obsidian-global-hotkeys plugin (community plugin,
Recommended approach for most dotfiles users
- 1. Track
.obsidian/hotkeys.jsonwith your dotfiles manager — covers in-app bindings across machines. - 2. Install obsidian-global-hotkeys and track
.obsidian/plugins/obsidian-global-hotkeys/data.json— adds system-wide reach with no extra tooling. - 3. If you already use Hammerspoon, add
init.luarules instead — keeps everything in one Lua file.
- 1. Track
Sources