Skip to content

Commit ac7774a

Browse files
committed
feat(tags): new format tag name first, better matching (#933)
1 parent 99684a6 commit ac7774a

File tree

2 files changed

+15
-10
lines changed

2 files changed

+15
-10
lines changed

lua/fzf-lua/defaults.lua

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -494,6 +494,10 @@ M.defaults.tags = {
494494
file_icons = true and M._has_devicons,
495495
git_icons = true,
496496
color_icons = true,
497+
fzf_opts = {
498+
["--delimiter"] = string.format("'[:%s]'", utils.nbsp),
499+
["--tiebreak"] = "begin",
500+
},
497501
_actions = function() return M.globals.actions.files end,
498502
actions = { ["ctrl-g"] = { actions.grep_lgrep } },
499503
}
@@ -502,16 +506,16 @@ M.defaults.btags = {
502506
previewer = { _ctor = previewers.builtin.tags },
503507
prompt = "BTags> ",
504508
ctags_file = nil, -- auto-detect
505-
rg_opts = "--no-heading --color=always",
506-
grep_opts = "--color=auto --perl-regexp",
509+
rg_opts = "--color=never --no-heading",
510+
grep_opts = "--color=never --perl-regexp",
507511
multiprocess = true,
508-
file_icons = true and M._has_devicons,
509-
git_icons = true,
512+
file_icons = false,
513+
git_icons = false,
510514
color_icons = true,
511515
fzf_opts = {
512-
["--delimiter"] = "'[:]'",
513-
["--with-nth"] = "2..",
514-
["--tiebreak"] = "index",
516+
["--delimiter"] = string.format("'[:%s]'", utils.nbsp),
517+
["--with-nth"] = "1,-1",
518+
["--tiebreak"] = "begin",
515519
},
516520
_actions = function() return M.globals.actions.files end,
517521
actions = { ["ctrl-g"] = false },

lua/fzf-lua/make_entry.lua

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -481,11 +481,12 @@ M.tag = function(x, opts)
481481
end
482482
local line, tag = text:match("(%d-);?(/.*/)")
483483
line = line and #line > 0 and tonumber(line)
484-
return ("%s%s: %s %s"):format(
484+
return ("%-30s%s%s%s: %s"):format(
485+
name,
486+
utils.nbsp,
485487
M.file(file, opts),
486488
not line and "" or ":" .. utils.ansi_codes.green(tostring(line)),
487-
utils.ansi_codes.magenta(name),
488-
utils.ansi_codes.green(tag)
489+
utils.ansi_codes.blue(tag)
489490
), line
490491
end
491492

0 commit comments

Comments
 (0)