mirror of
https://github.com/ThePrimeagen/harpoon.git
synced 2025-07-14 01:50:27 +00:00
Merge pull request #33 from brandoncc/add-file-toggling
Add file toggling
This commit is contained in:
commit
a6faacee32
@ -115,8 +115,8 @@ M.store_offset = function()
|
|||||||
local line = vim.api.nvim_eval("line('.')");
|
local line = vim.api.nvim_eval("line('.')");
|
||||||
end
|
end
|
||||||
|
|
||||||
M.rm_file = function()
|
M.rm_file = function(file_name_or_buf_id)
|
||||||
local buf_name = get_buf_name()
|
local buf_name = get_buf_name(file_name_or_buf_id)
|
||||||
local idx = M.get_index_of(buf_name)
|
local idx = M.get_index_of(buf_name)
|
||||||
|
|
||||||
if not M.valid_index(idx) then
|
if not M.valid_index(idx) then
|
||||||
@ -177,6 +177,21 @@ M.set_mark_list = function(new_list)
|
|||||||
config.marks = new_list
|
config.marks = new_list
|
||||||
end
|
end
|
||||||
|
|
||||||
|
M.toggle_file = function(file_name_or_buf_id)
|
||||||
|
local mark_count_before = #harpoon.get_mark_config().marks
|
||||||
|
|
||||||
|
M.add_file(file_name_or_buf_id)
|
||||||
|
|
||||||
|
local mark_count_after = #harpoon.get_mark_config().marks
|
||||||
|
|
||||||
|
if (mark_count_before == mark_count_after) then
|
||||||
|
M.rm_file(file_name_or_buf_id)
|
||||||
|
print("Mark removed")
|
||||||
|
else
|
||||||
|
print("Mark Added")
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
M.to_quickfix_list()
|
M.to_quickfix_list()
|
||||||
|
|
||||||
return M
|
return M
|
||||||
|
Loading…
x
Reference in New Issue
Block a user