From 1f5a77627d5cc2b25bb04f1888a7c86b7c503ed0 Mon Sep 17 00:00:00 2001 From: Jason Paris Date: Tue, 18 Nov 2025 14:05:09 -0500 Subject: [PATCH] fix: add symlink support to find commands The find commands in tag search and link following were failing when vault_path was a symbolic link because find doesn't follow symlinks by default. This caused "No tags found in frontmatter" errors and link following failures when using symlinked vaults. Added -L flag to find commands to follow symbolic links in: - search_tags() function in notes.lua - follow_link() fuzzy search fallback in links.lua This allows the plugin to work correctly with symlinked vault directories (e.g., ~/personal/docs/notes -> ~/personal/repos/notes). --- lua/markdown-notes/links.lua | 2 +- lua/markdown-notes/notes.lua | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lua/markdown-notes/links.lua b/lua/markdown-notes/links.lua index 7faa36c..5be1ce7 100644 --- a/lua/markdown-notes/links.lua +++ b/lua/markdown-notes/links.lua @@ -70,7 +70,7 @@ function M.follow_link() -- Try to find the file if exact match doesn't exist if vim.fn.filereadable(file_path) == 0 then - local find_cmd = "find " + local find_cmd = "find -L " .. vim.fn.expand(options.vault_path) .. " -name '*" .. link_text diff --git a/lua/markdown-notes/notes.lua b/lua/markdown-notes/notes.lua index 29b5af6..c264c10 100644 --- a/lua/markdown-notes/notes.lua +++ b/lua/markdown-notes/notes.lua @@ -160,8 +160,8 @@ function M.search_tags() local vault_path = vim.fn.expand(options.vault_path) - -- Get all markdown files - local find_cmd = "find " .. vim.fn.shellescape(vault_path) .. + -- Get all markdown files (-L follows symlinks) + local find_cmd = "find -L " .. vim.fn.shellescape(vault_path) .. " -name '*.md' -type f -not -path '*/.*'" local all_files = vim.fn.systemlist(find_cmd)