2023-02-01 19:11:37 +00:00
|
|
|
{
|
|
|
|
config,
|
|
|
|
lib,
|
|
|
|
...
|
2023-11-07 00:50:27 +00:00
|
|
|
}: let
|
2024-03-12 00:47:57 +00:00
|
|
|
inherit (lib.modules) mkIf;
|
|
|
|
inherit (lib.trivial) boolToString;
|
|
|
|
inherit (lib.strings) optionalString;
|
|
|
|
inherit (lib.nvim.lua) luaTable listToLuaTable;
|
|
|
|
inherit (lib.nvim.dag) entryAnywhere;
|
|
|
|
|
2023-03-01 12:22:41 +00:00
|
|
|
cfg = config.vim.statusline.lualine;
|
2023-12-07 01:31:08 +00:00
|
|
|
breadcrumbsCfg = config.vim.ui.breadcrumbs;
|
2023-03-01 12:22:41 +00:00
|
|
|
in {
|
|
|
|
config = (mkIf cfg.enable) {
|
|
|
|
vim.startPlugins = [
|
|
|
|
"lualine"
|
|
|
|
];
|
2023-02-01 19:11:37 +00:00
|
|
|
|
2024-03-12 00:47:57 +00:00
|
|
|
vim.luaConfigRC.lualine = entryAnywhere ''
|
2023-06-06 23:36:02 +00:00
|
|
|
local lualine = require('lualine')
|
|
|
|
lualine.setup {
|
2023-03-01 12:22:41 +00:00
|
|
|
options = {
|
|
|
|
icons_enabled = ${boolToString cfg.icons.enable},
|
|
|
|
theme = "${cfg.theme}",
|
|
|
|
component_separators = {"${cfg.componentSeparator.left}","${cfg.componentSeparator.right}"},
|
|
|
|
section_separators = {"${cfg.sectionSeparator.left}","${cfg.sectionSeparator.right}"},
|
2024-03-12 00:47:57 +00:00
|
|
|
disabled_filetypes = ${listToLuaTable cfg.disabledFiletypes},
|
2024-01-26 18:16:56 +00:00
|
|
|
always_divide_middle = ${boolToString cfg.alwaysDivideMiddle},
|
2023-03-01 12:22:41 +00:00
|
|
|
globalstatus = ${boolToString cfg.globalStatus},
|
2024-03-12 00:47:57 +00:00
|
|
|
ignore_focus = ${listToLuaTable cfg.ignoreFocus},
|
2023-07-30 08:41:09 +00:00
|
|
|
extensions = {${optionalString config.vim.filetree.nvimTree.enable "'nvim-tree'"}},
|
2023-03-01 12:22:41 +00:00
|
|
|
refresh = {
|
|
|
|
statusline = ${toString cfg.refresh.statusline},
|
|
|
|
tabline = ${toString cfg.refresh.tabline},
|
|
|
|
winbar = ${toString cfg.refresh.winbar},
|
|
|
|
},
|
|
|
|
},
|
2024-01-26 18:16:56 +00:00
|
|
|
|
2023-03-01 12:22:41 +00:00
|
|
|
-- active sections
|
|
|
|
sections = {
|
2024-03-12 00:47:57 +00:00
|
|
|
lualine_a = ${luaTable (cfg.activeSection.a ++ cfg.extraActiveSection.a)},
|
|
|
|
lualine_b = ${luaTable (cfg.activeSection.b ++ cfg.extraActiveSection.b)},
|
|
|
|
lualine_c = ${luaTable (cfg.activeSection.c ++ cfg.extraActiveSection.c)},
|
|
|
|
lualine_x = ${luaTable (cfg.activeSection.x ++ cfg.extraActiveSection.x)},
|
|
|
|
lualine_y = ${luaTable (cfg.activeSection.y ++ cfg.extraActiveSection.y)},
|
|
|
|
lualine_z = ${luaTable (cfg.activeSection.z ++ cfg.extraActiveSection.z)},
|
2023-03-01 12:22:41 +00:00
|
|
|
},
|
2024-01-26 18:16:56 +00:00
|
|
|
|
|
|
|
-- inactive sections
|
2023-03-01 12:22:41 +00:00
|
|
|
inactive_sections = {
|
2024-03-12 00:47:57 +00:00
|
|
|
lualine_a = ${luaTable (cfg.inactiveSection.a ++ cfg.extraInactiveSection.a)},
|
|
|
|
lualine_b = ${luaTable (cfg.inactiveSection.b ++ cfg.extraInactiveSection.b)},
|
|
|
|
lualine_c = ${luaTable (cfg.inactiveSection.c ++ cfg.extraInactiveSection.c)},
|
|
|
|
lualine_x = ${luaTable (cfg.inactiveSection.x ++ cfg.extraInactiveSection.x)},
|
|
|
|
lualine_y = ${luaTable (cfg.inactiveSection.y ++ cfg.extraInactiveSection.y)},
|
|
|
|
lualine_z = ${luaTable (cfg.inactiveSection.z ++ cfg.extraInactiveSection.z)},
|
2023-03-01 12:22:41 +00:00
|
|
|
},
|
2024-01-26 18:16:56 +00:00
|
|
|
|
|
|
|
-- tabline (currently unsupported)
|
2023-03-01 12:22:41 +00:00
|
|
|
tabline = {},
|
2023-07-28 14:08:42 +00:00
|
|
|
|
2023-12-07 01:31:08 +00:00
|
|
|
${optionalString (breadcrumbsCfg.enable && breadcrumbsCfg.source == "nvim-navic") ''
|
2024-01-26 18:16:56 +00:00
|
|
|
-- enable winbar if nvim-navic is enabled
|
2023-07-19 20:05:38 +00:00
|
|
|
winbar = {
|
|
|
|
lualine_c = {
|
|
|
|
{
|
|
|
|
"navic",
|
2023-08-14 12:25:06 +00:00
|
|
|
draw_empty = ${boolToString config.vim.ui.breadcrumbs.alwaysRender}
|
2023-07-19 20:05:38 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
2023-07-28 14:08:42 +00:00
|
|
|
''}
|
2023-03-01 12:22:41 +00:00
|
|
|
}
|
|
|
|
'';
|
2023-02-01 19:11:37 +00:00
|
|
|
};
|
|
|
|
}
|