From 46ddb742f177e70da616789b0d4d8377c882ff94 Mon Sep 17 00:00:00 2001 From: kxu111 Date: Wed, 1 Jul 2026 05:33:31 +1000 Subject: [PATCH 1/2] feat: marking directories --- lua/harpoon-core/mark.lua | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lua/harpoon-core/mark.lua b/lua/harpoon-core/mark.lua index 3b5f44d..30e1c62 100644 --- a/lua/harpoon-core/mark.lua +++ b/lua/harpoon-core/mark.lua @@ -84,9 +84,13 @@ end ---@return string? function M.filename(file) file = file or vim.api.nvim_buf_get_name(0) - if vim.fn.filereadable(file) == 0 then + if not file or file == '' then return nil end + -- instead of using oil.nvim's special paths, use the normal filesystem path + if file:sub(1, 6) == 'oil://' then + file = file:sub(7) + end local root = M.root() -- ignore path separator after root if file is in root -- file = a/b/c/d | root = a/b | c/d From 9e0a342686954c370fef0879e9e5bfc5bc66bbd0 Mon Sep 17 00:00:00 2001 From: kxu111 Date: Wed, 1 Jul 2026 05:58:22 +1000 Subject: [PATCH 2/2] fix: delete invalid entries --- lua/harpoon-core/mark.lua | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/lua/harpoon-core/mark.lua b/lua/harpoon-core/mark.lua index 30e1c62..eb1c3b8 100644 --- a/lua/harpoon-core/mark.lua +++ b/lua/harpoon-core/mark.lua @@ -84,13 +84,15 @@ end ---@return string? function M.filename(file) file = file or vim.api.nvim_buf_get_name(0) - if not file or file == '' then - return nil - end -- instead of using oil.nvim's special paths, use the normal filesystem path if file:sub(1, 6) == 'oil://' then file = file:sub(7) end + if vim.fn.filereadable(file) == 0 then + if vim.fn.isdirectory(file) == 0 then + return nil + end + end local root = M.root() -- ignore path separator after root if file is in root -- file = a/b/c/d | root = a/b | c/d