Skip to content

Commit

Permalink
feat(nvim): show search result in status
Browse files Browse the repository at this point in the history
  • Loading branch information
spywhere committed Feb 8, 2024
1 parent 85b998b commit 6757450
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions configs/nvim/lua/plugin/appearance/miniline.lua
Original file line number Diff line number Diff line change
Expand Up @@ -352,6 +352,40 @@ end)
end
}

[[SearchResult]] {
hl = colors.group('cyan', 'brightblack'),
visible = {
active = function (ctx)
return ctx.value ~= nil and ctx.value ~= ''
end
},
fn = function ()
if vim.v.hlsearch == 0 then
return ''
end
local count = fn.searchcount()
if not count then
return ''
end

if count.incomplete == 1 then
return string.format('[?/??]')
end

local current = count.current
local total = count.total

if count.incomplete == 2 and count.total > count.maxcount then
if count.current > count.maxcount then
current = string.format('>%d', count.current)
end
total = string.format('>%d', count.total)
end

return string.format('[%s/%s]', current, total)
end
}

[[Recording]] {
hl = colors.group('white', 'red'),
visible = {
Expand Down

0 comments on commit 6757450

Please sign in to comment.