diff --git a/doc/nvim-tree-lua.txt b/doc/nvim-tree-lua.txt index bb190e71..2f840a40 100644 --- a/doc/nvim-tree-lua.txt +++ b/doc/nvim-tree-lua.txt @@ -1262,6 +1262,6 @@ You can toggle marks on files/folders with default. To get the list of marked paths, you can call -`require("nvim-tree.marks").get_marks()`. This will return `{string}`. +`require("nvim-tree.marks").get_marks()`. This will return `{node}`. vim:tw=78:ts=4:sw=4:et:ft=help:norl: diff --git a/lua/nvim-tree/marks.lua b/lua/nvim-tree/marks/init.lua similarity index 86% rename from lua/nvim-tree/marks.lua rename to lua/nvim-tree/marks/init.lua index ac399e02..6f4e6800 100644 --- a/lua/nvim-tree/marks.lua +++ b/lua/nvim-tree/marks/init.lua @@ -7,7 +7,7 @@ local NvimTreeMarks = {} local M = {} local function add_mark(node) - NvimTreeMarks[node.absolute_path] = true + NvimTreeMarks[node.absolute_path] = node M.draw() end @@ -30,8 +30,8 @@ end function M.get_marks() local list = {} - for k in pairs(NvimTreeMarks) do - table.insert(list, k) + for _, node in pairs(NvimTreeMarks) do + table.insert(list, node) end return list end @@ -51,13 +51,14 @@ function M.draw() M.clear() local buf = view.get_bufnr() + local add = core.get_nodes_starting_line() - 1 Iterator.builder(core.get_explorer().nodes) :recursor(function(node) return node.open and node.nodes end) :applier(function(node, idx) if M.get_mark(node) then - vim.fn.sign_place(0, GROUP, SIGN_NAME, buf, { lnum = idx + 1, priority = 3 }) + vim.fn.sign_place(0, GROUP, SIGN_NAME, buf, { lnum = idx + add, priority = 3 }) end end) :iterate()