aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDefaultGen <gravel.justness270@slmail.me>2024-06-20 20:17:44 -0400
committerDefaultGen <gravel.justness270@slmail.me>2024-06-20 20:17:44 -0400
commit279acd45dea8aef043a30bc7f3dfdf033d98d3ea (patch)
tree9fc8c4e2b59f1475d1da58030213960a0b04345f
parente25509f7630c824234188dbdbb00d0793580f550 (diff)
downloadsimple-denote.nvim-279acd45dea8aef043a30bc7f3dfdf033d98d3ea.tar.gz
Changed tags to keywords
-rw-r--r--README.md18
-rw-r--r--lua/simple-denote.lua6
-rw-r--r--lua/simple-denote/api.lua28
-rw-r--r--lua/simple-denote/internal.lua28
4 files changed, 40 insertions, 40 deletions
diff --git a/README.md b/README.md
index 73c3fc2..9d53b6e 100644
--- a/README.md
+++ b/README.md
@@ -1,19 +1,19 @@
# simple-denote.nvim
-This Neovim 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):
+This Neovim plugin provides a command `:Denote note` that prompts for a title and keywords (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`
For example:
1. `20240601T174946--how-to-tie-a-tie__lifeskills_clothes.md`
-2. `20240601T180054--i-have-no-tags.org`
-3. `20240601T193022__im_only_tags.norg`
+2. `20240601T180054--title-only.org`
+3. `20240601T193022__only_keywords.norg`
4. `20240601T200121.txt`
-5. `20240601T213392==1a1--i-have-a-signature__denote_coolstuff.csv`
+5. `20240601T213392==1a1--i-have-a-signature__denote.csv`
That's all this does: create and consistently rename text files using the above scheme. No frontmatter, links, etc. I have overcomplicated my notes too many times with fancy Org Mode and Zettelkasten systems and this is my minimalist endgame.
-The file-naming should be 1:1 with denote.el, down to minor things like triming/combining excess whitespace, removing special characters, disallowing multi-word keywords (tags), and separating signature terms with = (e.g. `==three=word=sig`).
+The file-naming should be 1:1 with denote.el, down to minor things like triming/combining excess whitespace, removing special characters, disallowing multi-word keywords, and separating signature terms with = (e.g. `==three=word=sig`).
# Installation / Config
@@ -40,7 +40,7 @@ Maybe you want to set keymaps for the commands as well
```lua
vim.keymap.set({'n','v'}, '<leader>nn', ":Denote note<cr>", { desc = "New note" })
vim.keymap.set({'n','v'}, '<leader>nt', ":Denote title<cr>", { desc = "Change title" })
-vim.keymap.set({'n','v'}, '<leader>nk', ":Denote tag<cr>", { desc = "Change tags" })
+vim.keymap.set({'n','v'}, '<leader>nk', ":Denote keywords<cr>", { desc = "Change keywords" })
vim.keymap.set({'n','v'}, '<leader>nz', ":Denote signature<cr>", { desc = "Change signature" })
```
@@ -76,15 +76,15 @@ git pull
```vim
" Creates a new note in the `dir` directory with `ext` extension
-" Tags are space delimited. The title or tags can be blank.
+" Keywords are space delimited. The title or keywords can be blank.
:Denote note
" Renames the current note with the new title
" If `retitle_heading` is true, overwrites the first line heading as well
:Denote title
-" Renames the current note with the new list of tags (space delimited)
-:Denote tag
+" Renames the current note with the new list of keywords (space delimited)
+:Denote keywords
" Rename the current note with a signature
" This has a user-defined meaning and no particular purpose
diff --git a/lua/simple-denote.lua b/lua/simple-denote.lua
index 403a5ac..8ac2193 100644
--- a/lua/simple-denote.lua
+++ b/lua/simple-denote.lua
@@ -9,8 +9,8 @@ function M.load_cmd(options)
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] == "keywords" then
+ api.keywords(options)
elseif opts.fargs[1] == "signature" then
api.signature(options)
else
@@ -19,7 +19,7 @@ function M.load_cmd(options)
end, {
nargs = 1,
complete = function()
- return { "note", "title", "tag", "signature" }
+ return { "note", "title", "keywords", "signature" }
end,
})
end
diff --git a/lua/simple-denote/api.lua b/lua/simple-denote/api.lua
index 05d645a..6a25f4a 100644
--- a/lua/simple-denote/api.lua
+++ b/lua/simple-denote/api.lua
@@ -4,20 +4,20 @@ local internal = require("simple-denote.internal")
---@param options table
---@param title string|nil
----@param tags table|nil
-function M.note(options, title, tags)
+---@param keywords table|nil
+function M.note(options, title, keywords)
if not title then
vim.ui.input({ prompt = "Note title: " }, function(input)
title = input
end)
end
- if not tags then
- vim.ui.input({ prompt = "Tags: " }, function(input)
- tags = input
+ if not keywords then
+ vim.ui.input({ prompt = "Keywords: " }, function(input)
+ keywords = input
end)
end
- if not title or not tags then return end
- internal.note(options, title, tags)
+ if not title or not keywords then return end
+ internal.note(options, title, keywords)
end
---@param options table
@@ -38,18 +38,18 @@ end
---@param options table
---@param filename string|nil
----@param tags table|nil
-function M.tag(options, filename, tags)
+---@param keywords table|nil
+function M.keyword(options, filename, keywords)
if not filename then
filename = vim.fn.expand("%")
end
- if not tags then
- vim.ui.input({ prompt = "New tags: " }, function(input)
- tags = input
+ if not keywords then
+ vim.ui.input({ prompt = "New keywords: " }, function(input)
+ keywords = input
end)
end
- if not tags then return end
- internal.tag(options, filename, tags)
+ if not keywords then return end
+ internal.keyword(options, filename, keywords)
end
---@param options table
diff --git a/lua/simple-denote/internal.lua b/lua/simple-denote/internal.lua
index c2f8046..73ba71f 100644
--- a/lua/simple-denote/internal.lua
+++ b/lua/simple-denote/internal.lua
@@ -18,8 +18,8 @@ function M.plain_format(str)
end
---@param str string
----@param char delimiter that replaces spaces (- for titles, _ for tags, = for sigs)
----Format the title/tags/sig string of a Denote filename
+---@param char delimiter that replaces spaces (- for titles, _ for keywords, = for sigs)
+---Format the title/keywords/sig string of a Denote filename
function M.format_denote_string(str, char)
str = M.plain_format(str)
if str == "" then return "" end
@@ -52,15 +52,15 @@ end
---@param options table
---@param title string
----@param tags string
+---@param keywords string
---Edit a new note with a Denote filename
-function M.note(options, title, tags)
+function M.note(options, title, keywords)
title = M.trim(title)
local og_title = title
- tags = M.format_denote_string(tags, "_")
+ keywords = M.format_denote_string(keywords, "_")
title = M.format_denote_string(title, "-")
local file = options.dir .. os.date("%Y%m%dT%H%M%S")
- file = file .. title .. tags .. "." .. options.ext
+ file = file .. title .. keywords .. "." .. options.ext
vim.cmd("edit " .. file)
if options.add_heading and og_title ~= "" then
M.set_heading(options, og_title)
@@ -79,23 +79,23 @@ function M.title(options, filename, title)
error("This doesn't look like a Denote filename")
end
local sig = filename:match(".-(==[^%-%_%.]*)")
- local tags = filename:match(".-(__.*)%..*")
- if not tags then tags = "" end
+ local keywords = filename:match(".-(__.*)%..*")
+ if not keywords then keywords = "" end
if not sig then sig = "" end
title = M.trim(title)
if options.retitle_heading then
M.set_heading(options, title)
end
title = M.format_denote_string(title, "-")
- local new_filename = prefix .. sig .. title .. tags .. "." .. options.ext
+ local new_filename = prefix .. sig .. title .. keywords .. "." .. options.ext
M.replace_file(filename, new_filename)
end
---@param options table
---@param filename string
----@param tags string
----Replaces the __tags in filename
-function M.tag(options, filename, tags)
+---@param keywords string
+---Replaces the __keywords in filename
+function M.keyword(options, filename, keywords)
local prefix = filename:match("^(.*)__.*$")
if not prefix then
prefix = filename:match("^(.*)%..-$")
@@ -103,8 +103,8 @@ function M.tag(options, filename, tags)
if not prefix:match("%d%d%d%d%d%d%d%dT%d%d%d%d%d%d") then
error("This doesn't look like a Denote filename")
end
- tags = M.format_denote_string(tags, "_")
- local new_filename = prefix .. tags .. "." .. options.ext
+ keywords = M.format_denote_string(keywords, "_")
+ local new_filename = prefix .. keywords .. "." .. options.ext
M.replace_file(filename, new_filename)
end