2022-10-19 09:06:45 +00:00
|
|
|
local function searchcount()
|
|
|
|
if vim.v.hlsearch == 0 then
|
2022-10-19 09:07:21 +00:00
|
|
|
return ''
|
2022-10-19 09:06:45 +00:00
|
|
|
end
|
|
|
|
|
2022-10-19 09:07:21 +00:00
|
|
|
local result = vim.fn.searchcount { maxcount = 999, timeout = 500 }
|
2022-10-19 09:06:45 +00:00
|
|
|
local denominator = math.min(result.total, result.maxcount)
|
2022-10-19 09:07:21 +00:00
|
|
|
return string.format('[%d/%d]', result.current, denominator)
|
2022-10-19 09:06:45 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
return searchcount
|