mirror of
https://github.com/ThePrimeagen/harpoon.git
synced 2025-07-14 18:10:28 +00:00
parent
574adeb96d
commit
047cd66d6f
@ -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 = {}
|
local M = {}
|
||||||
|
|
||||||
---@alias HarpoonListItem {value: any, context: any}
|
---@alias HarpoonListItem {value: any, context: any}
|
||||||
@ -127,7 +133,7 @@ function M.get_default_config()
|
|||||||
-- path, if that is the case we can use the context to
|
-- path, if that is the case we can use the context to
|
||||||
-- store the bufname and then have value be the normalized
|
-- store the bufname and then have value be the normalized
|
||||||
-- value
|
-- 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)
|
local bufnr = vim.fn.bufnr(name, false)
|
||||||
|
|
||||||
|
@ -43,6 +43,10 @@ function HarpoonList:length()
|
|||||||
return #self.items
|
return #self.items
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function HarpoonList:clear()
|
||||||
|
self.items = {}
|
||||||
|
end
|
||||||
|
|
||||||
---@return HarpoonList
|
---@return HarpoonList
|
||||||
function HarpoonList:append(item)
|
function HarpoonList:append(item)
|
||||||
item = item or self.config.add()
|
item = item or self.config.add()
|
||||||
|
@ -1,9 +1,5 @@
|
|||||||
local Path = require("plenary.path")
|
|
||||||
|
|
||||||
local M = {}
|
local M = {}
|
||||||
function M.normalize_path(item)
|
|
||||||
return Path:new(item):make_relative(M.project_key())
|
|
||||||
end
|
|
||||||
|
|
||||||
function M.is_white_space(str)
|
function M.is_white_space(str)
|
||||||
return str:gsub("%s", "") == ""
|
return str:gsub("%s", "") == ""
|
||||||
|
Loading…
x
Reference in New Issue
Block a user