2023-02-01 20:11:37 +01:00
|
|
|
{
|
|
|
|
config,
|
|
|
|
lib,
|
|
|
|
...
|
2023-11-07 01:50:27 +01:00
|
|
|
}: let
|
2024-03-12 01:47:57 +01: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 13:22:41 +01:00
|
|
|
cfg = config.vim.statusline.lualine;
|
2023-12-07 02:31:08 +01:00
|
|
|
breadcrumbsCfg = config.vim.ui.breadcrumbs;
|
2023-03-01 13:22:41 +01:00
|
|
|
in {
|
|
|
|
config = (mkIf cfg.enable) {
|
|
|
|
vim.startPlugins = [
|
|
|
|
"lualine"
|
|
|
|
];
|
2023-02-01 20:11:37 +01:00
|
|
|
|
2024-03-12 01:47:57 +01:00
|
|
|
vim.luaConfigRC.lualine = entryAnywhere ''
|
2023-06-07 01:36:02 +02:00
|
|
|
local lualine = require('lualine')
|
|
|
|
lualine.setup {
|
2023-03-01 13:22:41 +01: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 01:47:57 +01:00
|
|
|
disabled_filetypes = ${listToLuaTable cfg.disabledFiletypes},
|
2024-01-26 19:16:56 +01:00
|
|
|
always_divide_middle = ${boolToString cfg.alwaysDivideMiddle},
|
2023-03-01 13:22:41 +01:00
|
|
|
globalstatus = ${boolToString cfg.globalStatus},
|
2024-03-12 01:47:57 +01:00
|
|
|
ignore_focus = ${listToLuaTable cfg.ignoreFocus},
|
2023-07-30 10:41:09 +02:00
|
|
|
extensions = {${optionalString config.vim.filetree.nvimTree.enable "'nvim-tree'"}},
|
2023-03-01 13:22:41 +01:00
|
|
|
refresh = {
|
|
|
|
statusline = ${toString cfg.refresh.statusline},
|
|
|
|
tabline = ${toString cfg.refresh.tabline},
|
|
|
|
winbar = ${toString cfg.refresh.winbar},
|
|
|
|
},
|
|
|
|
},
|
2024-01-26 19:16:56 +01:00
|
|
|
|
2023-03-01 13:22:41 +01:00
|
|
|
-- active sections
|
|
|
|
sections = {
|
2024-03-12 01:47:57 +01: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 13:22:41 +01:00
|
|
|
},
|
2024-01-26 19:16:56 +01:00
|
|
|
|
|
|
|
-- inactive sections
|
2023-03-01 13:22:41 +01:00
|
|
|
inactive_sections = {
|
2024-03-12 01:47:57 +01: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 13:22:41 +01:00
|
|
|
},
|
2024-01-26 19:16:56 +01:00
|
|
|
|
|
|
|
-- tabline (currently unsupported)
|
2023-03-01 13:22:41 +01:00
|
|
|
tabline = {},
|
2023-07-28 16:08:42 +02:00
|
|
|
|
2023-12-07 02:31:08 +01:00
|
|
|
${optionalString (breadcrumbsCfg.enable && breadcrumbsCfg.source == "nvim-navic") ''
|
2024-01-26 19:16:56 +01:00
|
|
|
-- enable winbar if nvim-navic is enabled
|
2023-07-19 22:05:38 +02:00
|
|
|
winbar = {
|
|
|
|
lualine_c = {
|
|
|
|
{
|
|
|
|
"navic",
|
2023-08-14 14:25:06 +02:00
|
|
|
draw_empty = ${boolToString config.vim.ui.breadcrumbs.alwaysRender}
|
2023-07-19 22:05:38 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
2023-07-28 16:08:42 +02:00
|
|
|
''}
|
2023-03-01 13:22:41 +01:00
|
|
|
}
|
|
|
|
'';
|
2023-02-01 20:11:37 +01:00
|
|
|
};
|
|
|
|
}
|