Skip to content

Obsidian Quick Switch keymap (<leader>oq) uses hyphen and fails: 'quick-switch' should be 'quick_switch' #160

@cardugarte

Description

@cardugarte

Bug

The <leader>oq keymap for Obsidian Quick Switch is bound to :Obsidian quick-switch (with a hyphen), which fails at runtime with:

Command 'quick-switch' not found

Root cause

obsidian.nvim registers the subcommand with an underscore, not a hyphen:

-- obsidian.nvim/lua/obsidian/commands/init.lua
M.register("quick_switch", { nargs = "?" })

Command dispatch is a direct table lookup by exact key — there is no hyphen→underscore normalization:

-- obsidian.nvim/lua/obsidian/commands/init.lua  (handle_command)
local cmdconfig = M.commands[cmd]
if cmdconfig == nil then
  log.err("Command '" .. cmd .. "' not found")
  return
end

So Obsidian quick-switch resolves to M.commands["quick-switch"]nil → error. The correct invocation is Obsidian quick_switch.

Affected file

GentlemanNvim/nvim/lua/config/keymaps.lua:34

vim.keymap.set("n", "<leader>oq", "<cmd>Obsidian quick-switch<CR>", { desc = "Quick Switch" })

The other 7 Obsidian keymaps in that block (check, template, open, backlinks, links, new, search) are correct — only quick_switch uses an underscore in the plugin's registered name.

Fix

Change quick-switchquick_switch. PR incoming.

Environment

  • obsidian-nvim/obsidian.nvim with version = "*" (latest release)
  • Neovim managed by lazy.nvim

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions