Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions lua/telescope/builtin.lua
Original file line number Diff line number Diff line change
Expand Up @@ -833,4 +833,35 @@ builtin.marks = function(opts)
}):find()
end

builtin.tagstack = function(opts)
opts = opts or {}
local tagstack = vim.fn.gettagstack()
if vim.tbl_isempty(tagstack.items) then
print("No tagstack available")
return
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

probably should print a message "No tagstack available" or similar.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

end

for i, value in ipairs(tagstack.items) do
value.text = value.tagname
value.lnum = value.from[2]
value.filename = vim.fn.bufname(value.from[1])
end

-- reverse the list
tags = {}
for i=#tagstack.items, 1, -1 do
table.insert(tags, tagstack.items[i])
end

pickers.new(opts, {
prompt_title = 'TagStack',
finder = finders.new_table {
results = tags,
entry_maker = make_entry.gen_from_quickfix(opts),
},
previewer = previewers.qflist.new(opts),
sorter = conf.generic_sorter(opts),
}):find()
end

return builtin