feat(mark): add status method

This method can be used to display current mark status in the statusline
This commit is contained in:
Asbjørn Håland 2021-03-17 17:22:48 +01:00
parent a6faacee32
commit aefeb6bc9d

View File

@ -60,6 +60,15 @@ M.get_index_of = function(item)
return nil
end
M.status = function()
local idx = M.get_index_of(get_buf_name())
if M.valid_index(idx) then
return "M" .. idx
end
return ""
end
M.valid_index = function(idx)
local config = harpoon.get_mark_config()
return idx ~= nil and config.marks[idx] ~= nil and config.marks[idx] ~= ""