Replace blocks with helper function `is_enabled`

dev
otherJL0 3 years ago
parent d6b971aa29
commit ea65f4e20e

@ -296,9 +296,7 @@ components.active[2][1] = {
return "" return ""
end, end,
enabled = shortline or function(winid) enabled = is_enabled(shortline, winid, 80),
return vim.api.nvim_win_get_width(winid) > 80
end,
hl = { hl = {
fg = clrs.rosewater, fg = clrs.rosewater,
bg = sett.bkg, bg = sett.bkg,
@ -362,9 +360,7 @@ components.active[2][5] = {
components.active[3][1] = { components.active[3][1] = {
provider = "git_branch", provider = "git_branch",
enabled = shortline or function(winid) enabled = is_enabled(shortline, winid, 70),
return vim.api.nvim_win_get_width(winid) > 70
end,
hl = { hl = {
fg = sett.extras, fg = sett.extras,
bg = sett.bkg, bg = sett.bkg,
@ -400,9 +396,7 @@ components.active[3][3] = {
end end
return " " .. icon .. " " .. filename .. " " return " " .. icon .. " " .. filename .. " "
end, end,
enabled = shortline or function(winid) enabled = is_enabled(shortline, winid, 70),
return vim.api.nvim_win_get_width(winid) > 70
end,
hl = { hl = {
fg = sett.bkg, fg = sett.bkg,
bg = sett.curr_file, bg = sett.curr_file,
@ -422,9 +416,7 @@ components.active[3][4] = {
return "" .. dir_name .. " " return "" .. dir_name .. " "
end, end,
enabled = shortline or function(winid) enabled = is_enabled(shortline, winid, 80),
return vim.api.nvim_win_get_width(winid) > 80
end,
hl = { hl = {
fg = sett.bkg, fg = sett.bkg,

Loading…
Cancel
Save