diff --git a/lua/fzf-lua/make_entry.lua b/lua/fzf-lua/make_entry.lua index c65321f..5f45db8 100644 --- a/lua/fzf-lua/make_entry.lua +++ b/lua/fzf-lua/make_entry.lua @@ -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 diff --git a/lua/fzf-lua/providers/tags.lua b/lua/fzf-lua/providers/tags.lua index 168b87d..5248b85 100644 --- a/lua/fzf-lua/providers/tags.lua +++ b/lua/fzf-lua/providers/tags.lua @@ -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