From d21d7758dae1e80f2a50bcda580179bf12bf2bf1 Mon Sep 17 00:00:00 2001 From: Thomas Vanbesien Date: Wed, 24 Jun 2026 17:31:53 +0200 Subject: fix(nvim): check that NOTES_DIR exists before running code that depends on it --- plugin/50-notes.lua | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'plugin/50-notes.lua') 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 @@ -- `` / `` (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 -- cgit v1.3.1