mirror of
https://github.com/ThePrimeagen/harpoon.git
synced 2025-07-13 17:40:25 +00:00
feat(quickfix)
This commit is contained in:
parent
00529d3ec2
commit
1a549418ad
@ -36,6 +36,17 @@ local function get_index_of(item)
|
|||||||
return nil
|
return nil
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local function filter_nulls(list)
|
||||||
|
local next = {}
|
||||||
|
for idx = 1, #list do
|
||||||
|
if list[idx] ~= nil then
|
||||||
|
table.insert(next, list[idx])
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
return next
|
||||||
|
end
|
||||||
|
|
||||||
local function get_buf_name(id)
|
local function get_buf_name(id)
|
||||||
if id == nil then
|
if id == nil then
|
||||||
return utils.normalize_path(vim.fn.bufname(vim.fn.bufnr()))
|
return utils.normalize_path(vim.fn.bufname(vim.fn.bufnr()))
|
||||||
@ -145,15 +156,8 @@ M.promote_to_front = function(id)
|
|||||||
end
|
end
|
||||||
|
|
||||||
M.remove_nils = function()
|
M.remove_nils = function()
|
||||||
local next = {}
|
|
||||||
local config = harpoon.get_mark_config()
|
local config = harpoon.get_mark_config()
|
||||||
for idx = 1, #config.marks do
|
config.marks = filter_nulls(config.marks)
|
||||||
if config.marks[idx] ~= nil then
|
|
||||||
table.insert(next, config.marks[idx])
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
config.marks = next
|
|
||||||
end
|
end
|
||||||
|
|
||||||
M.shorten_list = function(count)
|
M.shorten_list = function(count)
|
||||||
@ -185,5 +189,20 @@ M.get_length = function()
|
|||||||
return #harpoon.get_mark_config().marks
|
return #harpoon.get_mark_config().marks
|
||||||
end
|
end
|
||||||
|
|
||||||
|
M.to_quickfix_list = function()
|
||||||
|
local config = harpoon.get_mark_config()
|
||||||
|
local file_list = filter_nulls(config.marks)
|
||||||
|
local qf_list = {}
|
||||||
|
for idx = 1, #file_list do
|
||||||
|
qf_list[idx] = {
|
||||||
|
text = string.format("%d: %s", idx, file_list[idx]),
|
||||||
|
filename = file_list[idx],
|
||||||
|
}
|
||||||
|
end
|
||||||
|
vim.fn.setqflist(qf_list)
|
||||||
|
end
|
||||||
|
|
||||||
|
M.to_quickfix_list()
|
||||||
|
|
||||||
return M
|
return M
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user