fix(nvim): properly check searchcount in heirline

This commit is contained in:
Price Hiller 2023-09-30 11:12:21 -05:00
parent 1176858f95
commit db6575d2d1
Signed by: Price
SSH Key Fingerprint: SHA256:Y4S9ZzYphRn1W1kbJerJFO6GGsfu9O70VaBSxJO7dF8

View File

@ -156,7 +156,7 @@ return {
["sshconfig"] = { icon = "󰴳", icon_color = colors.carpYellow }, ["sshconfig"] = { icon = "󰴳", icon_color = colors.carpYellow },
["sshdconfig"] = "sshconfig", ["sshdconfig"] = "sshconfig",
["help"] = { icon = "󰋗", icon_color = colors.springGreen }, ["help"] = { icon = "󰋗", icon_color = colors.springGreen },
["octo"] = { icon = "", icon_color = colors.fujiWhite } ["octo"] = { icon = "", icon_color = colors.fujiWhite },
} }
local buftype_overrides = { local buftype_overrides = {
@ -541,8 +541,8 @@ return {
{ {
FileNameBlock, FileNameBlock,
static = { static = {
bg_color_right = nil bg_color_right = nil,
} },
}, },
margin(1), margin(1),
{ {
@ -776,7 +776,7 @@ return {
VimMode, VimMode,
{ {
condition = function() condition = function()
return vim.v.hlsearch ~= 0 return #vim.fn.searchcount() ~= 0
end, end,
{ {
provider = " " .. seps.full.left, provider = " " .. seps.full.left,
@ -809,7 +809,15 @@ return {
end, end,
provider = function(self) provider = function(self)
local search = self.search local search = self.search
return string.format(" %d/%d", search.current, math.min(search.total, search.maxcount)) if search == nil then
return " ?/?"
else
return string.format(
" %d/%d",
search.current,
math.min(search.total, search.maxcount)
)
end
end, end,
hl = { hl = {
fg = colors.fujiWhite, fg = colors.fujiWhite,
@ -890,14 +898,14 @@ return {
{ {
{ {
provider = seps.full.left, provider = seps.full.left,
hl = { fg = colors.sumiInk4, bg = utils.get_highlight("StatusLine").bg } hl = { fg = colors.sumiInk4, bg = utils.get_highlight("StatusLine").bg },
}, },
{ {
FileNameBlock, FileNameBlock,
static = { static = {
bg_color_right = utils.get_highlight("StatusLine").bg bg_color_right = utils.get_highlight("StatusLine").bg,
} },
} },
}, },
margin(1), margin(1),
{ {