mirror of
https://github.com/ThePrimeagen/harpoon.git
synced 2025-07-14 01:50:27 +00:00
Add file toggling
This commit is contained in:
parent
af09f2c99b
commit
fc20d9a922
@ -119,8 +119,8 @@ M.swap = function(a, b)
|
||||
swap(a_idx, b_idx)
|
||||
end
|
||||
|
||||
M.rm_file = function()
|
||||
local buf_name = get_buf_name()
|
||||
M.rm_file = function(file_name_or_buf_id)
|
||||
local buf_name = get_buf_name(file_name_or_buf_id)
|
||||
local idx = get_index_of(buf_name)
|
||||
|
||||
if not valid_index(idx) then
|
||||
@ -213,6 +213,21 @@ M.set_mark_list = function(new_list)
|
||||
config.marks = new_list
|
||||
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()
|
||||
|
||||
return M
|
||||
|
Loading…
x
Reference in New Issue
Block a user