Skip to content

Commit

Permalink
fix: addresses #346 and #345
Browse files Browse the repository at this point in the history
  • Loading branch information
ThePrimeagen committed Dec 1, 2023
1 parent 574adeb commit 047cd66
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 5 deletions.
8 changes: 7 additions & 1 deletion lua/harpoon/config.lua
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
local Path = require("plenary.path")
local function normalize_path(buf_name)
return Path:new(buf_name):make_relative(vim.loop.cwd())
end


local M = {}

---@alias HarpoonListItem {value: any, context: any}
Expand Down Expand Up @@ -127,7 +133,7 @@ function M.get_default_config()
-- path, if that is the case we can use the context to
-- store the bufname and then have value be the normalized
-- value
or vim.api.nvim_buf_get_name(vim.api.nvim_get_current_buf())
or normalize_path(vim.api.nvim_buf_get_name(vim.api.nvim_get_current_buf()))

local bufnr = vim.fn.bufnr(name, false)

Expand Down
4 changes: 4 additions & 0 deletions lua/harpoon/list.lua
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,10 @@ function HarpoonList:length()
return #self.items
end

function HarpoonList:clear()
self.items = {}
end

---@return HarpoonList
function HarpoonList:append(item)
item = item or self.config.add()
Expand Down
4 changes: 0 additions & 4 deletions lua/harpoon/utils.lua
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
local Path = require("plenary.path")

local M = {}
function M.normalize_path(item)
return Path:new(item):make_relative(M.project_key())
end

function M.is_white_space(str)
return str:gsub("%s", "") == ""
Expand Down

0 comments on commit 047cd66

Please sign in to comment.