|
|
@ -1,7 +1,13 @@
|
|
|
|
|
|
|
|
local M = {}
|
|
|
|
|
|
|
|
|
|
|
|
local lsp = require("feline.providers.lsp")
|
|
|
|
local lsp = require("feline.providers.lsp")
|
|
|
|
local lsp_severity = vim.diagnostic.severity
|
|
|
|
local lsp_severity = vim.diagnostic.severity
|
|
|
|
local b = vim.b
|
|
|
|
local b = vim.b
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
local clrs = require("catppuccin.palettes.init").get_palette()
|
|
|
|
|
|
|
|
local ucolors = require("catppuccin.utils.colors")
|
|
|
|
|
|
|
|
local latte = require("catppuccin.palettes.latte")
|
|
|
|
|
|
|
|
|
|
|
|
local assets = {
|
|
|
|
local assets = {
|
|
|
|
left_semicircle = "",
|
|
|
|
left_semicircle = "",
|
|
|
|
right_semicircle = "",
|
|
|
|
right_semicircle = "",
|
|
|
@ -26,11 +32,9 @@ local assets = {
|
|
|
|
slim_dot = "•",
|
|
|
|
slim_dot = "•",
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
local clrs = require("catppuccin.palettes.init").get_palette()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-- settings
|
|
|
|
|
|
|
|
local sett = {
|
|
|
|
local sett = {
|
|
|
|
bkg = clrs.surface0,
|
|
|
|
text = ucolors.vary_color({ latte = latte.base }, clrs.surface0),
|
|
|
|
|
|
|
|
bkg = ucolors.vary_color({ latte = latte.crust }, clrs.surface0),
|
|
|
|
diffs = clrs.mauve,
|
|
|
|
diffs = clrs.mauve,
|
|
|
|
extras = clrs.overlay1,
|
|
|
|
extras = clrs.overlay1,
|
|
|
|
curr_file = clrs.maroon,
|
|
|
|
curr_file = clrs.maroon,
|
|
|
@ -60,8 +64,27 @@ local mode_colors = {
|
|
|
|
["!"] = { "SHELL", clrs.green },
|
|
|
|
["!"] = { "SHELL", clrs.green },
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function M.setup(opts)
|
|
|
|
|
|
|
|
if opts then
|
|
|
|
|
|
|
|
opts.assets = opts.assets or {}
|
|
|
|
|
|
|
|
opts.sett = opts.sett or {}
|
|
|
|
|
|
|
|
opts.mode_colors = opts.mode_colors or {}
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
opts = {}
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
assets = vim.tbl_deep_extend("force", assets, opts.assets)
|
|
|
|
|
|
|
|
sett = vim.tbl_deep_extend("force", sett, opts.sett)
|
|
|
|
|
|
|
|
mode_colors = vim.tbl_deep_extend("force", mode_colors, opts.mode_colors)
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function M.get()
|
|
|
|
local shortline = false
|
|
|
|
local shortline = false
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
local components = {
|
|
|
|
|
|
|
|
active = {},
|
|
|
|
|
|
|
|
inactive = {},
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
local function is_enabled(is_shortline, winid, min_width)
|
|
|
|
local function is_enabled(is_shortline, winid, min_width)
|
|
|
|
if is_shortline then
|
|
|
|
if is_shortline then
|
|
|
|
return true
|
|
|
|
return true
|
|
|
@ -71,12 +94,6 @@ local function is_enabled(is_shortline, winid, min_width)
|
|
|
|
return vim.api.nvim_win_get_width(winid) > min_width
|
|
|
|
return vim.api.nvim_win_get_width(winid) > min_width
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
-- Initialize the components table
|
|
|
|
|
|
|
|
local components = {
|
|
|
|
|
|
|
|
active = {},
|
|
|
|
|
|
|
|
inactive = {},
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
table.insert(components.active, {}) -- (1) left
|
|
|
|
table.insert(components.active, {}) -- (1) left
|
|
|
|
table.insert(components.active, {}) -- (2) center
|
|
|
|
table.insert(components.active, {}) -- (2) center
|
|
|
|
table.insert(components.active, {}) -- (3) right
|
|
|
|
table.insert(components.active, {}) -- (3) right
|
|
|
@ -112,9 +129,9 @@ end
|
|
|
|
-- Current vi mode ------>
|
|
|
|
-- Current vi mode ------>
|
|
|
|
local vi_mode_hl = function()
|
|
|
|
local vi_mode_hl = function()
|
|
|
|
return {
|
|
|
|
return {
|
|
|
|
fg = sett.bkg,
|
|
|
|
fg = sett.text,
|
|
|
|
bg = mode_colors[vim.fn.mode()][2],
|
|
|
|
bg = mode_colors[vim.fn.mode()][2],
|
|
|
|
style = { "bold" },
|
|
|
|
style = "bold",
|
|
|
|
}
|
|
|
|
}
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
@ -132,7 +149,7 @@ components.active[1][2] = {
|
|
|
|
provider = "",
|
|
|
|
provider = "",
|
|
|
|
hl = function()
|
|
|
|
hl = function()
|
|
|
|
return {
|
|
|
|
return {
|
|
|
|
fg = sett.bkg,
|
|
|
|
fg = sett.text,
|
|
|
|
bg = mode_colors[vim.fn.mode()][2],
|
|
|
|
bg = mode_colors[vim.fn.mode()][2],
|
|
|
|
}
|
|
|
|
}
|
|
|
|
end,
|
|
|
|
end,
|
|
|
@ -145,7 +162,7 @@ components.active[1][3] = {
|
|
|
|
hl = vi_mode_hl,
|
|
|
|
hl = vi_mode_hl,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
-- there is a dilema: we need to hide Diffs if there is no git info. We can do that, but this will
|
|
|
|
-- there is a dilema: we need to hide Diffs if ther is no git info. We can do that, but this will
|
|
|
|
-- leave the right_semicircle colored with purple, and since we can't change the color conditonally
|
|
|
|
-- leave the right_semicircle colored with purple, and since we can't change the color conditonally
|
|
|
|
-- then the solution is to create two right_semicircles: one with a mauve sett.bkg and the other one normal
|
|
|
|
-- then the solution is to create two right_semicircles: one with a mauve sett.bkg and the other one normal
|
|
|
|
-- sett.bkg; both have the same fg (vi mode). The mauve one appears if there is git info, else the one with
|
|
|
|
-- sett.bkg; both have the same fg (vi mode). The mauve one appears if there is git info, else the one with
|
|
|
@ -184,7 +201,7 @@ components.active[1][5] = {
|
|
|
|
components.active[1][6] = {
|
|
|
|
components.active[1][6] = {
|
|
|
|
provider = "git_diff_added",
|
|
|
|
provider = "git_diff_added",
|
|
|
|
hl = {
|
|
|
|
hl = {
|
|
|
|
fg = sett.bkg,
|
|
|
|
fg = sett.text,
|
|
|
|
bg = sett.diffs,
|
|
|
|
bg = sett.diffs,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
icon = " ",
|
|
|
|
icon = " ",
|
|
|
@ -193,7 +210,7 @@ components.active[1][6] = {
|
|
|
|
components.active[1][7] = {
|
|
|
|
components.active[1][7] = {
|
|
|
|
provider = "git_diff_changed",
|
|
|
|
provider = "git_diff_changed",
|
|
|
|
hl = {
|
|
|
|
hl = {
|
|
|
|
fg = sett.bkg,
|
|
|
|
fg = sett.text,
|
|
|
|
bg = sett.diffs,
|
|
|
|
bg = sett.diffs,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
icon = " ",
|
|
|
|
icon = " ",
|
|
|
@ -202,7 +219,7 @@ components.active[1][7] = {
|
|
|
|
components.active[1][8] = {
|
|
|
|
components.active[1][8] = {
|
|
|
|
provider = "git_diff_removed",
|
|
|
|
provider = "git_diff_removed",
|
|
|
|
hl = {
|
|
|
|
hl = {
|
|
|
|
fg = sett.bkg,
|
|
|
|
fg = sett.text,
|
|
|
|
bg = sett.diffs,
|
|
|
|
bg = sett.diffs,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
icon = " ",
|
|
|
|
icon = " ",
|
|
|
@ -394,11 +411,11 @@ components.active[3][3] = {
|
|
|
|
icon = " "
|
|
|
|
icon = " "
|
|
|
|
return icon
|
|
|
|
return icon
|
|
|
|
end
|
|
|
|
end
|
|
|
|
return "%m" .. " " .. icon .. " " .. filename .. " "
|
|
|
|
return " " .. icon .. " " .. filename .. " "
|
|
|
|
end,
|
|
|
|
end,
|
|
|
|
enabled = is_enabled(shortline, winid, 70),
|
|
|
|
enabled = is_enabled(shortline, winid, 70),
|
|
|
|
hl = {
|
|
|
|
hl = {
|
|
|
|
fg = sett.bkg,
|
|
|
|
fg = sett.text,
|
|
|
|
bg = sett.curr_file,
|
|
|
|
bg = sett.curr_file,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
left_sep = {
|
|
|
|
left_sep = {
|
|
|
@ -415,11 +432,9 @@ components.active[3][4] = {
|
|
|
|
local dir_name = vim.fn.fnamemodify(vim.fn.getcwd(), ":t")
|
|
|
|
local dir_name = vim.fn.fnamemodify(vim.fn.getcwd(), ":t")
|
|
|
|
return " " .. dir_name .. " "
|
|
|
|
return " " .. dir_name .. " "
|
|
|
|
end,
|
|
|
|
end,
|
|
|
|
|
|
|
|
|
|
|
|
enabled = is_enabled(shortline, winid, 80),
|
|
|
|
enabled = is_enabled(shortline, winid, 80),
|
|
|
|
|
|
|
|
|
|
|
|
hl = {
|
|
|
|
hl = {
|
|
|
|
fg = sett.bkg,
|
|
|
|
fg = sett.text,
|
|
|
|
bg = sett.curr_dir,
|
|
|
|
bg = sett.curr_dir,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
left_sep = {
|
|
|
|
left_sep = {
|
|
|
@ -433,3 +448,6 @@ components.active[3][4] = {
|
|
|
|
-- ######## Right
|
|
|
|
-- ######## Right
|
|
|
|
|
|
|
|
|
|
|
|
return components
|
|
|
|
return components
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return M
|
|
|
|