Merge pull request #111 from otherJL0/feline

dev
Pocco81 3 years ago committed by GitHub
commit 8a67df6da4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -23,7 +23,7 @@ local assets = {
slant_right_2 = "",
slant_right_2_thin = "",
chubby_dot = "",
slim_dot = '',
slim_dot = "",
}
local clrs = require("catppuccin.core.color_palette")
@ -62,6 +62,15 @@ local mode_colors = {
local shortline = false
local function is_enabled(is_shortline, winid, min_width)
if is_shortline then
return true
end
winid = winid or 0
return vim.api.nvim_win_get_width(winid) > min_width
end
-- Initialize the components table
local components = {
active = {},
@ -77,7 +86,7 @@ local invi_sep = {
str = " ",
hl = {
fg = sett.bkg,
bg = sett.bkg
bg = sett.bkg,
},
}
@ -85,17 +94,19 @@ local invi_sep = {
local function any_git_changes()
local gst = b.gitsigns_status_dict -- git stats
if gst then
if gst["added"] and gst["added"] > 0 or gst["removed"] and gst["removed"] > 0 or gst["changed"] and gst["changed"] > 0 then
if
gst["added"] and gst["added"] > 0
or gst["removed"] and gst["removed"] > 0
or gst["changed"] and gst["changed"] > 0
then
return true
end
end
return false
end
-- #################### STATUSLINE ->
-- ######## Left
-- Current vi mode ------>
@ -103,7 +114,7 @@ local vi_mode_hl = function()
return {
fg = sett.bkg,
bg = mode_colors[vim.fn.mode()][2],
style = "bold"
style = "bold",
}
end
@ -146,12 +157,12 @@ components.active[1][4] = {
hl = function()
return {
fg = mode_colors[vim.fn.mode()][2],
bg = sett.bkg
bg = sett.bkg,
}
end,
enabled = function()
return not any_git_changes()
end
end,
}
-- enable if git diffs are available
@ -160,12 +171,12 @@ components.active[1][5] = {
hl = function()
return {
fg = mode_colors[vim.fn.mode()][2],
bg = sett.diffs
bg = sett.diffs,
}
end,
enabled = function()
return any_git_changes()
end
end,
}
-- Current vi mode ------>
@ -205,7 +216,7 @@ components.active[1][9] = {
},
enabled = function()
return any_git_changes()
end
end,
}
-- Diffs ------>
@ -230,7 +241,7 @@ components.active[1][10] = {
-- end,
hl = {
fg = sett.extras,
bg = sett.bkg
bg = sett.bkg,
},
left_sep = invi_sep,
}
@ -243,7 +254,7 @@ components.active[1][11] = {
-- end,
hl = {
fg = sett.extras,
bg = sett.bkg
bg = sett.bkg,
},
left_sep = invi_sep,
}
@ -285,12 +296,10 @@ components.active[2][1] = {
return ""
end,
enabled = shortline or function(winid)
return vim.api.nvim_win_get_width(winid) > 80
end,
enabled = is_enabled(shortline, winid, 80),
hl = {
fg = clrs.rosewater,
bg = sett.bkg
bg = sett.bkg,
},
}
@ -351,12 +360,10 @@ components.active[2][5] = {
components.active[3][1] = {
provider = "git_branch",
enabled = shortline or function(winid)
return vim.api.nvim_win_get_width(winid) > 70
end,
enabled = is_enabled(shortline, winid, 70),
hl = {
fg = sett.extras,
bg = sett.bkg
bg = sett.bkg,
},
icon = "",
left_sep = invi_sep,
@ -373,7 +380,7 @@ components.active[3][2] = {
end,
hl = {
fg = sett.extras,
bg = sett.bkg
bg = sett.bkg,
},
right_sep = invi_sep,
}
@ -389,9 +396,7 @@ components.active[3][3] = {
end
return " " .. icon .. " " .. filename .. " "
end,
enabled = shortline or function(winid)
return vim.api.nvim_win_get_width(winid) > 70
end,
enabled = is_enabled(shortline, winid, 70),
hl = {
fg = sett.bkg,
bg = sett.curr_file,
@ -411,9 +416,7 @@ components.active[3][4] = {
return "" .. dir_name .. " "
end,
enabled = shortline or function(winid)
return vim.api.nvim_win_get_width(winid) > 80
end,
enabled = is_enabled(shortline, winid, 80),
hl = {
fg = sett.bkg,

Loading…
Cancel
Save