dendrite.nvim#

Reference Neovim plugin for Dendrite. It manages the daemon lifecycle, provides user commands, integrates with nvim-cmp for completion, and exposes Lua functions for note operations.

dependencies#

DependencyRequiredPurpose
telescope.nvimYesProvides the picker UI for directory selection, backlink viewing, and tag search.
plenary.nvimYesUsed by Telescope for async operations.
nvim-cmpOptionalPowers slug and tag completion inside markdown files. Completion is silently disabled if not present.

installation#

Add dendrite.nvim to your plugin manager and call the setup function with your vault configuration. Example using lazy.nvim:

{
  "KristianJBorgwarth/dendrite.nvim",
  dependencies = {
    "nvim-telescope/telescope.nvim",
    "nvim-lua/plenary.nvim",
  },
  config = function()
    require("dendrite").setup({
      vault_name = "atlas",
      vault_path = "~/notes/atlas",
      templates_dir = "~/notes/atlas/.templates",
      scratch_notes = {
        dir = "~/notes/atlas/scratches",
        template_name = "scratch",
      },
      daily_notes = {
        dir = "~/notes/atlas/daily",
        filename_format = "%Y-%m-%d.md",
        template_name = "daily",
      },
    })
  end,
}

configuration#

OptionDefaultDescription
vault_name"dendrite-vault"Unique name for the vault. Passed to vault/init.
vault_path"~/dendrite-vault"Absolute path to the vault directory.
templates_dir"~/dendrite-vault/.templates"Path to the template directory.
scratch_notes.dir"~/dendrite-vault/scratches"Directory where scratch notes are placed.
scratch_notes.template_name"scratch"Template used when creating a scratch note.
daily_notes.dir"~/dendrite-vault/daily"Directory where daily notes are placed.
daily_notes.filename_format"%Y-%m-%d.md"Lua date format string for daily note filenames.
daily_notes.template_name"daily"Template used when creating a daily note.

commands#

CommandShortDescription
:DendriteRebuild:DrbTriggers a full index rebuild via vault/rebuild.
:DendriteBacklinks:DblOpens a Telescope picker showing backlinks for the current note.
:DendriteSearchTags:DtsOpens a dynamic Telescope picker that searches notes by tag as you type.

lua API#

The public module require("dendrite") exposes the following functions:

FunctionDescription
setup(opts)Starts the daemon, initializes the vault, and registers autocommands.
new_note(template_name, root_dir)Prompts for a title, lets you pick a subdirectory, then creates the note.
daily_note()Creates a daily note using the configured daily template and directory.
scratch_note()Prompts for a title and creates a scratch note.
goto_link()Resolves the link under the cursor and navigates to it (opens buffer or URL).

automatic behaviors#

The plugin registers the following autocommands on setup:

  1. BufWritePost on *.md: When a vault markdown file is saved, the plugin issues note/save to re-index the note, then immediately calls diagnostics/links to refresh broken-link warnings.

  2. BufEnter on *.md: When entering a vault markdown buffer, the plugin calls diagnostics/links so broken-link warnings appear without needing to save first.

  3. VimLeavePre: Sends a kill signal to the daemon process, ensuring clean shutdown when Neovim exits.

diagnostics#

The plugin uses Neovim’s built-in diagnostic API to display broken-link warnings inline. Whenever a vault markdown file is opened or saved, the plugin calls diagnostics/links and publishes any results as WARN-level diagnostics under the dendrite namespace.

A broken link appears as an underline at the exact column position of the [[slug]] reference. The diagnostic message identifies the missing target. Diagnostics are cleared and re-computed on every save or buffer entry, so they always reflect the current state of the index.

deleting notes#

The plugin does not expose a delete command. Neovim has no native hook that fires reliably when a file is removed from disk, and adding one would require a third-party plugin. To keep the plugin focused, this is left to the user.

When you delete a note from the vault, run :DendriteRebuild to re-sync the index. The daemon’s note/delete method is available to other clients that do have reliable file-deletion hooks.

completion#

When nvim-cmp is installed, the plugin registers a custom completion source named dendrite. This source activates in markdown buffers and provides two kinds of completions:

TriggerBehavior
Typing inside [[Completes note slugs via completion/slug.
Typing inside tags: ["Completes tag names via completion/tag.

The dendrite source is added with priority 150, placing it above most general purpose sources.