summaryrefslogtreecommitdiffstats
path: root/plugin/50-notes.lua
diff options
context:
space:
mode:
authorThomas Vanbesien <tvanbesi@proton.me>2026-06-24 17:31:53 +0200
committerThomas Vanbesien <tvanbesi@proton.me>2026-06-24 17:35:22 +0200
commitd21d7758dae1e80f2a50bcda580179bf12bf2bf1 (patch)
treed67b2f744f43554792700cbcd6138b9dd8660a6d /plugin/50-notes.lua
parentd08a3df4f5cbc8411d295e00bf8e42b0bf5c5355 (diff)
downloadnvim-config-d21d7758dae1e80f2a50bcda580179bf12bf2bf1.tar.gz
nvim-config-d21d7758dae1e80f2a50bcda580179bf12bf2bf1.zip
fix(nvim): check that NOTES_DIR exists before running code that depends on it
Diffstat (limited to 'plugin/50-notes.lua')
-rw-r--r--plugin/50-notes.lua8
1 files changed, 4 insertions, 4 deletions
diff --git a/plugin/50-notes.lua b/plugin/50-notes.lua
index 11a8aef..fa55743 100644
--- a/plugin/50-notes.lua
+++ b/plugin/50-notes.lua
@@ -27,11 +27,11 @@
-- `<Tab>` / `<S-Tab>` (in notes buffers): go to next/previous followable entity
--
-if vim.env.NOTES_DIR == nil then
- vim.notify("NOTES_DIR is not set", vim.log.levels.ERROR)
+local notes_dir = require("dotfiles.notes").dir
+if notes_dir == nil then
+ vim.notify("50-notes.lua: NOTES_DIR is not set, notes wiki disabled", vim.log.levels.WARN)
return
end
-local notes_dir = vim.fs.normalize(vim.env.NOTES_DIR)
local tagfile = vim.fs.joinpath(vim.fn.stdpath("state"), "notes-tags")
local follow = require("dotfiles.follow")
@@ -199,7 +199,7 @@ end
-- Returns a note's path relative to the notes dir, without `.md`, or nil if not a note.
local function note_rel_path(path)
- local prefix = vim.fs.normalize(notes_dir) .. "/"
+ local prefix = notes_dir .. "/"
path = vim.fs.normalize(path)
if not vim.startswith(path, prefix) then
return nil