better ctag parsing to accomodate for line numbers (#355)

main
bhagwan 2 years ago
parent 95b82e7973
commit daf4f63819

@ -319,14 +319,14 @@ M.file = function(opts, x)
end
M.tag = function(opts, x)
local line = nil
local name, file, text = x:match("^(.*)\t(.*)\t(/.*/)")
local name, file, text = x:match("^(.*)\t(.*)\t(.*/)")
local line, tag = text:match("(%d-);?(/.*/)")
if not file then return x end
return ("%s%s: %s %s"):format(
M.file(opts, file),
not line and "" or ":"..utils.ansi_codes.green(tostring(line)),
utils.ansi_codes.magenta(name),
utils.ansi_codes.green(text))
M.file(opts, file),
(not line or #line==0) and "" or ":"..utils.ansi_codes.green(tostring(line)),
utils.ansi_codes.magenta(name),
utils.ansi_codes.green(tag))
end
return M

@ -192,6 +192,7 @@ local function tags(opts)
opts.requires_processing = true
local contents = core.mt_cmd_wrapper(opts)
opts = core.set_header(opts, 2)
opts = core.set_fzf_field_index(opts)
return core.fzf_files(opts, contents)
end

Loading…
Cancel
Save