From dd178bb90f501297c3b5e714f95d0f233a4303a4 Mon Sep 17 00:00:00 2001 From: DefaultGen Date: Thu, 6 Jun 2024 04:45:03 -0400 Subject: Manual install section --- README.md | 45 +++++++++++++++++++++++++++++++++---------- lua/simple-denote/config.lua | 2 +- lua/simple-denote/init.lua | 46 -------------------------------------------- 3 files changed, 36 insertions(+), 57 deletions(-) delete mode 100644 lua/simple-denote/init.lua diff --git a/README.md b/README.md index 86df4d7..dae6c5c 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # simple-denote.nvim -This plugin provides a command `:Denote note` that prompts for a title and tags, then creates a new file in your notes directory using the emacs `denote` package file-naming scheme: +This plugin provides a command `:Denote note` that prompts for a title and tags, then creates a new file in a flat notes directory using the [Emacs Denote package's file-naming scheme](https://protesilaos.com/emacs/denote#h:4e9c7512-84dc-4dfb-9fa9-e15d51178e5d): `DATE==SIGNATURE--TITLE__KEYWORDS.EXTENSION` @@ -11,8 +11,9 @@ For example: 4. `20240601T200121.md` 5. `20240601T213392==1a1--i-have-a-signature__denote_coolstuff.md` -There is no support for frontmatter, links, or any other denote features. I just like the file-naming scheme. It's easy to parse, search, and sort chronologically. You can read more about it here: -https://protesilaos.com/emacs/denote#h:4e9c7512-84dc-4dfb-9fa9-e15d51178e5d +There is no frontmatter, linking, or any other features. I have overcomplicated my notes too many times with fancy Org Mode and Zettelkasten systems and this is my minimalist endgame. + +You can use this on its own or with more featureful plugins like [neorg](https://github.com/nvim-neorg/neorg), [wiki.vim](https://github.com/lervag/wiki.vim), or [Marksman](https://github.com/artempyanykh/marksman), but if your plugin has built in templates you can probably just recreate the denote spec with those instead of using this. # Installation / Config @@ -32,6 +33,8 @@ Example config via [lazy.nvim](https://github.com/folke/lazy.nvim) The heading options automatically support Markdown (#) and Org/Norg (*) headings. +## Keymaps + Maybe you want to set keymaps for the commands as well ```lua @@ -41,26 +44,48 @@ vim.keymap.set({'n','v'}, 'nk', "Denote tag", { desc = "C vim.keymap.set({'n','v'}, 'nz', "Denote signature", { desc = "Change signature" }) ``` +## Manual Install + +To install without a package manager: + +```bash +mkdir -p ~/.local/share/nvim/site/pack/simple-denote.nvim/start +cd ~/.local/share/nvim/site/pack/simple-denote.nvim/start +git clone https://github.com/DefaultGen/simple-denote.nvim +``` + +Add the following to `~/.config/nvim/init.lua` + +```lua +require('simple-denote').setup({ + ext = "md", + dir = "~/notes", + add_heading = true, + retitle_heading = true, +} +``` + +### Manual upgrade + +```bash +cd ~/.local/share/nvim/site/pack/simple-denote.nvim/start/simple-denote.nvim +git pull +``` + # :Denote Command ```vim " Creates a new note in the `dir` directory with `ext` extension " Tags are space delimited. The title or tags can be blank. :Denote note -``` -```vim " Renames the current note with the new title " If `retitle_heading` is true, overwrites the first line heading as well :Denote title -``` -```vim " Renames the current note with the new list of tags (space delimited) :Denote tag -``` -```vim " Rename the current note with a signature " This has a user-defined meaning and no particular purpose :Denote signature @@ -68,7 +93,7 @@ vim.keymap.set({'n','v'}, 'nz', "Denote signature", { desc = "C # Credits -* [HumanEntity's denote.nvim](https://github.com/HumanEntity/denote.nvim) - This project was based on denote.nvim and modified to suit my personal preference or closer adhere to the original Denote spec. +* [HumanEntity/denote.nvim](https://github.com/HumanEntity/denote.nvim) - This project was based on denote.nvim and modified to suit my personal preference or closer adhere to the original Denote spec. * [denote.el](https://protesilaos.com/emacs/denote) - The original Emacs package # License diff --git a/lua/simple-denote/config.lua b/lua/simple-denote/config.lua index ad7dffc..efd69c0 100644 --- a/lua/simple-denote/config.lua +++ b/lua/simple-denote/config.lua @@ -5,7 +5,7 @@ M.defaults = { dir = "~/notes/", add_heading = true, retitle_heading = true, - heading_char = "" + heading_char = "" -- This gets set automatically } M.options = M.defaults diff --git a/lua/simple-denote/init.lua b/lua/simple-denote/init.lua deleted file mode 100644 index 3f199fe..0000000 --- a/lua/simple-denote/init.lua +++ /dev/null @@ -1,46 +0,0 @@ -local M = {} - -local api = require("simple-denote.api") -local config = require("simple-denote.config") - -function M.load_cmd(options) - vim.api.nvim_create_user_command("Denote", function(opts) - if opts.fargs[1] == "note" then - api.note(options) - elseif opts.fargs[1] == "title" then - api.title(options) - elseif opts.fargs[1] == "tag" then - api.tag(options) - elseif opts.fargs[1] == "signature" then - api.signature(options) - else - error("Unsupported operation " .. opts.fargs[1]) - end - end, { - nargs = 1, - complete = function() - return { "note", "title", "tag", "signature" } - end, - }) -end - ----Add / to directory if necessary and set the heading_char based on the ext -function M.fix_options() - if config.options.dir:sub(-1) ~= "/" then - config.options.dir = config.options.dir .. "/" - end - if config.options.ext == "md" then - config.options.heading_char = "#" - elseif config.options.ext == "org" or config.options.ext == "norg" then - config.options.heading_char = "*" - end -end - ----@param options? table user configuration -function M.setup(options) - config.options = vim.tbl_deep_extend("force", config.defaults, options or {}) - M.fix_options() - M.load_cmd(config.options) -end - -return M -- cgit v1.2.3