Skip to content

About

Simple notes for Neovim with an efficient file-naming scheme

Topics

Resources

Stars

10 stars

Watchers

2 watching

Forks

Latest commit

 

History

187 Commits

Folders and files

Repository files navigation

denote.nvim

Note

I'm working on this project in my free time, so expect bursts of changes as I get said free time. This is already functional and provides an API you can use to make custom hooks and implement your own pipelines for using the denote naming convention. That said, I'm working on an in-process LSP that enables having other nice things. If you are interested in that, point Neovim to use that branch. Open to issues, ideas, PRs, etc. Help me make this plugin great!

This Neovim plugin provides a command :Denote that contains subcommands to create and rename text files in a flat notes directory using the Emacs Denote package's file-naming scheme.

The file-naming scheme is as follows:

DATE==SIGNATURE--TITLE__KEYWORDS.EXTENSION

For example:

20240601T174946--how-to-tie-a-tie__lifeskills_clothes.md
20240601T180054--title-only.org
20240601T193022__only_keywords.norg
20240601T200121.txt
20240601T213392==1a1--i-have-a-signature__denote.csv

Features

  • Single access point for all functionality via the :Denote command
  • Create new notes interactively
  • Extensions for integrating with other plugins (e.g. telescope.nvim)

Installation and configuration

Denote requires Neovim 0.11 or newer.

Set vim.g.denote before the plugin loads. For example, with lazy.nvim:

{
  "cvigilv/denote.nvim",
  init = function()
    vim.g.denote = {
      filetype = "markdown-toml",
      directory = "~/notes/",
      prompts = { "title", "keywords" },
      integrations = {
        highlights = false,
        telescope = false,
      },
    }
  end,
}

The plugin validates this table, fills in omitted defaults, and stores the normalized configuration in vim.g.denote.

:Denote Command

The bare :Denote command is available in every buffer. Its subcommands are listed and accepted only when the current buffer has a Denote filetype, such as markdown.denote.

Currently, the :Denote command supports the following subcommands:

  • :Denote, create a new note interactively
  • :Denote rename-file, renames the current note interactively
  • :Denote rename-file-title, change the title of the current note
  • :Denote rename-file-keywords, change the keywords of the current note
  • :Denote rename-file-signature, change the signature of the current note
  • :Denote backlinks, populates and opens loclist with backlinks to current note

Extensions

Filename highlights

Set integrations.highlights to true to highlight the identifier, signature, title, keywords, and extension in Denote filenames. Matching is not limited to the configured notes directory, so this option is disabled by default.

vim.g.denote = {
  integrations = {
    highlights = true,
  },
}
Denote filename highlighting in oil.nvim

nvim-telescope/telescope.nvim

Install nvim-telescope/telescope.nvim and set integrations.telescope to true to load the extension. If you use lazy.nvim, list Telescope as a dependency so it is available when Denote loads.

The integration adds these subcommands in Denote buffers:

  • :Denote search, search for notes
  • :Denote insert-link, select a note and insert a link

To configure both pickers, use integrations.telescope = { enabled = true, opts = { ... } }. Denote passes opts to each picker.

Simple telescope.nvim search

nvim-orgmode/orgmode

If you use nvim-orgmode/orgmode, you can enable the [[denote:...]] link format. This is done by adding the following to your orgmode configuration:

require("orgmode").setup({
  -- your config...
  hyperlinks = {
    sources = {
      require("denote.extensions.orgmode"):new({
        files = vim.g.denote.directory
      }),
    },
  },
})

The files option is required. Link completion scans this directory for valid Denote files using the supported note extensions: .md, .norg, .org, and .txt.

Tests

Run the headless Neovim test suite with:

make test

Set NVIM to test a specific executable, for example make test NVIM=nvim-0.11. CI tests Neovim 0.11, stable, and nightly on Linux, plus stable on macOS and Windows.

LLM disclosure

I work on this project with the help of an AI coding agent. I direct it, review it, and am responsible for the result. The agent assists me, not the other way around. For that reason my commits credit the agent with an Assisted-by: trailer instead of Co-authored-by:. No LLM provider is an author of these commits or accountable for them.

Credits

License

MIT

About

Simple notes for Neovim with an efficient file-naming scheme

Topics

Resources

Stars

10 stars

Watchers

2 watching

Forks

Releases

Contributors

Languages