Skip to content

Latest commit

 

History

126 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

denote.nvim

Note

I'm working on this project on my free time, so expect bursts of change as I get so 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 / Config

Example config via lazy.nvim

---@class Denote.Integrations.Telescope.Configuration
---@field enabled boolean
---@field opts table?

---@class Denote.Integrations.Configuration
---@field oil boolean Activate `stevearc/oil.nvim` extension
---@field telescope boolean|Denote.Integrations.Telescope.Configuration

---@class Denote.Configuration
---@field filetype string? Default note file type
---@field directory string? Denote files directory
---@field prompts string[]? File creation/renaming prompt order
---@field integrations Denote.Integrations.Configuration? Extensions configuration

--@type Denote.Configuration
vim.g.denote = {
  filetype = "markdown-toml",
  directory = "~/notes/",
  prompts = { "title", "keywords" },
  integrations = {
    oil = false,
    telescope = false,
  },
}

On setup, the plugin will create a global variable denote that contains the configuration table, which can be employed for extensions or other custom functionality:

vim.g.denote

:Denote Command

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

stevearc/oil.nvim

If you use stevearc/oil.nvim to manage your files, this extension will automatically setup custom highlighting to files that follow the Denote file-naming scheme whenever you open an oil buffer on the directory set in vim.g.denote.

Note: the highlighting is only applied when the oil extension is enabled in the config, but it will highlight any file that follows the scheme, regardless of the directory.

stevearc/oil.nvim highlighting

nvim-telescope/telescope.nvim

If you use nvim-telescope/telescope.nvim, you can register the telescope extension to access to some functionality directly from telescope. Currently, the following pickers are implemented:

  • :Telescope denote search, for searching notes in you Denote silo
  • :Telescope denote insert-link, for inserting links interactively
  • :Telescope denote link, for inserting links
  • :Telescope denote backlinks, for searching backlinks of current buffer
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
      }),
    },
  },
})

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