Fix tagrelative option not considered in builtin.tags (#2583)
* Fix tagrelative option not considered in builtin.tags * Fix wrong notify name * ctags filtering with grep or rg and normalize path * pass stylua check --------- Co-authored-by: James Trew <j.trew10@gmail.com>
This commit is contained in:
@@ -529,6 +529,23 @@ files.current_buffer_fuzzy_find = function(opts)
|
||||
end
|
||||
|
||||
files.tags = function(opts)
|
||||
-- find lines not matching tags file format (begins with !) or empty lines.
|
||||
local tags_command = (function()
|
||||
if 1 == vim.fn.executable "rg" then
|
||||
return { "rg", "-H", "-N", "--no-heading", "--color", "never", "-v", "^!|^$" }
|
||||
elseif 1 == vim.fn.executable "grep" then
|
||||
return { "grep", "-H", "--color=never", "-v", "^!\\|^$" }
|
||||
end
|
||||
end)()
|
||||
|
||||
if not tags_command then
|
||||
utils.notify("builtin.tags", {
|
||||
msg = "You need to install either grep or rg",
|
||||
level = "ERROR",
|
||||
})
|
||||
return
|
||||
end
|
||||
|
||||
local tagfiles = opts.ctags_file and { opts.ctags_file } or vim.fn.tagfiles()
|
||||
for i, ctags_file in ipairs(tagfiles) do
|
||||
tagfiles[i] = vim.fn.expand(ctags_file, true)
|
||||
@@ -545,7 +562,7 @@ files.tags = function(opts)
|
||||
pickers
|
||||
.new(opts, {
|
||||
prompt_title = "Tags",
|
||||
finder = finders.new_oneshot_job(flatten { "cat", tagfiles }, opts),
|
||||
finder = finders.new_oneshot_job(flatten { tags_command, tagfiles }, opts),
|
||||
previewer = previewers.ctags.new(opts),
|
||||
sorter = conf.generic_sorter(opts),
|
||||
attach_mappings = function()
|
||||
|
||||
Reference in New Issue
Block a user