All options passed to require("obsidian-cli").setup(opts). Every option has a sensible default — setup({}) works out of the box if Obsidian is running and a vault is loaded.
require("obsidian-cli").setup({
-- Path to the obsidian binary. Override if not on your PATH.
binary = "obsidian",
-- Target a specific vault by name. nil = use Obsidian's currently active vault.
-- Useful when you have multiple vaults and want to pin to one.
vault = nil,
-- Explicit vault path. nil = auto-detect via `obsidian vault info=path`.
-- Used for buffer-scoped keymaps and to absolutize vault-relative paths.
vault_path = nil,
-- Picker backend: "snacks", "quickfix", or nil to auto-detect.
-- Snacks is preferred when installed; quickfix is the fallback.
picker = nil,
-- Register default keymaps. Set false to wire your own.
keymaps = true,
-- Disable diagnostics inside vault markdown buffers (e.g. markdownlint
-- noise about MD041, MD012). Set false to keep diagnostics enabled.
disable_diagnostics_in_vault = true,
-- Buffer-local options applied to markdown files inside the vault.
-- Set false to leave buffers untouched.
buffer_options = {
wrap = true,
linebreak = true,
breakindent = true,
colorcolumn = "80",
spell = false,
conceallevel = 2,
},
})- Type:
string - Default:
"obsidian" - Purpose: the executable name or absolute path to the Obsidian CLI binary. Override if
obsidianisn't on yourPATHor you want to pin a specific version.
- Type:
string | nil - Default:
nil - Purpose: vault name to target (matches the name shown in Obsidian's vault switcher). When set, every CLI invocation includes
vault=<name>so commands operate on the specified vault even if Obsidian has a different vault in focus. Useful for multi-vault setups.
- Type:
string | nil - Default:
nil - Purpose: absolute path to the vault directory. When
nil, the plugin auto-detects viaobsidian vault info=pathon first use. Set this explicitly if:- You want to skip the auto-detect step (saves one CLI call)
- You're targeting a vault other than the currently active one in the app
- You want vault detection to work even when the app starts without a vault loaded
- Note:
~is expanded automatically.
- Type:
"snacks" | "quickfix" | nil - Default:
nil - Purpose: explicit picker backend. When
nil, the plugin auto-detects: Snacks ifsnacks.nvimis installed, otherwise quickfix. Set explicitly to override the detection. - v0.0.x note: only Snacks and quickfix adapters ship in v0.0.x. Telescope and fzf-lua adapters are planned for v0.1.0.
- Type:
number - Default:
20 - Purpose: maximum number of entries shown by
:ObsidianRecent. The plugin enumerates all vault markdown files, sorts by mtime, and trims to this count. Raise if your vault is large and you want to browse deeper.
- Type:
boolean - Default:
true - Purpose: when
true, the plugin registers default<leader>o*keymaps. Setfalseto opt out and wire your own.
- Type:
boolean - Default:
true - Purpose: disables
vim.diagnosticrendering for markdown buffers inside the vault. Default is on because most users find markdownlint warnings (MD041, MD012, etc.) noisy when writing personal notes. Setfalseto keep diagnostics active in vault buffers. - Scope: only affects vault buffers. Markdown files outside the vault are untouched.
- Type:
table | false - Default: see above
- Purpose: buffer-local options applied to markdown files inside the vault. Each key/value is set via
vim.api.nvim_set_option_valuewithscope = "local". Set the whole field tofalseto leave buffers untouched.
| Key | Default | Why |
|---|---|---|
wrap |
true |
Soft-wrap long paragraphs at the window edge |
linebreak |
true |
When wrapping, break at word boundaries instead of mid-word |
breakindent |
true |
Wrapped lines visually align with their indent |
colorcolumn |
"80" |
Visual guide at column 80 (no enforcement) |
spell |
false |
Off by default — Vim's built-in spell flags too many false positives without a properly-loaded dictionary. Most users prefer Obsidian's own spell-check. |
conceallevel |
2 |
Lets render-markdown.nvim hide markdown syntax characters when rendering |
To change the wrap column or enable hard-wrap instead of soft-wrap:
require("obsidian-cli").setup({
buffer_options = {
textwidth = 80,
formatoptions = "tcqln",
wrap = false,
colorcolumn = "+1", -- shows the column 1 past textwidth
},
})To enable spell-check with a specific dictionary:
require("obsidian-cli").setup({
buffer_options = {
wrap = true,
linebreak = true,
spell = true,
spelllang = "en_us",
},
})If you have more than one vault and want a per-machine default:
require("obsidian-cli").setup({
vault = "Work", -- name as it appears in the app
vault_path = "~/Documents/Vaults/Work", -- explicit path for path-aware features
})To switch vaults at runtime, you'd need to call setup again with different options. A cleaner runtime switcher is planned for v0.1.0 (:ObsidianWorkspace).
The recommended install uses event = "VeryLazy" for simplicity. If you want the plugin to load ONLY when you first open a markdown file (saving ~10-20ms on startup), use ft = "markdown" instead:
{
"jeryldev/obsidian-cli.nvim",
ft = "markdown",
opts = {},
}Trade-off: commands like :ObsidianToday won't work until you've opened at least one markdown file. Once the first markdown file loads, all 44 commands and keymaps become available.
For even stricter control (plugin loads ONLY when you invoke a specific command), list the commands you use in cmd =:
{
"jeryldev/obsidian-cli.nvim",
cmd = { "ObsidianToday", "ObsidianFind", "ObsidianSearch" },
opts = {},
}If <leader>o* conflicts with your existing bindings:
require("obsidian-cli").setup({
keymaps = false,
})
-- Then wire your own with whatever prefix you want:
vim.keymap.set("n", "<leader>nt", "<cmd>ObsidianToday<cr>")
vim.keymap.set("n", "<leader>nf", "<cmd>ObsidianFind<cr>")
vim.keymap.set("n", "<leader>ns", "<cmd>ObsidianSearch<cr>")
-- ... etcSee docs/commands.md for the full list of :Obsidian* commands.