2023-02-01 20:11:37 +01:00
|
|
|
{
|
|
|
|
config,
|
|
|
|
lib,
|
|
|
|
...
|
2023-11-07 01:50:27 +01:00
|
|
|
}: let
|
2024-05-15 11:51:07 +02:00
|
|
|
inherit (builtins) map;
|
2024-07-10 23:07:04 +02:00
|
|
|
inherit (lib.modules) mkIf mkMerge mkDefault;
|
2024-03-12 01:47:57 +01:00
|
|
|
inherit (lib.trivial) boolToString;
|
|
|
|
inherit (lib.nvim.dag) entryAnywhere;
|
2024-03-16 10:29:32 +01:00
|
|
|
inherit (lib.nvim.lua) toLuaObject;
|
|
|
|
inherit (lib.generators) mkLuaInline;
|
2024-03-12 01:47:57 +01:00
|
|
|
|
2023-03-01 13:22:41 +01:00
|
|
|
cfg = config.vim.statusline.lualine;
|
2024-09-13 16:26:03 +02:00
|
|
|
bCfg = config.vim.ui.breadcrumbs;
|
2023-03-01 13:22:41 +01:00
|
|
|
in {
|
2024-01-03 00:55:15 +01:00
|
|
|
config = mkMerge [
|
|
|
|
# TODO: move into nvim-tree file
|
2024-07-08 23:57:58 +02:00
|
|
|
(mkIf config.vim.filetree.nvimTree.enable {
|
2024-01-03 00:55:15 +01:00
|
|
|
vim.statusline.lualine.setupOpts = {
|
|
|
|
extensions = ["nvim-tree"];
|
|
|
|
};
|
|
|
|
})
|
2024-09-13 16:26:03 +02:00
|
|
|
|
|
|
|
(mkIf (bCfg.enable && bCfg.lualine.winbar.enable && bCfg.source == "nvim-navic") {
|
2024-01-03 00:55:15 +01:00
|
|
|
vim.statusline.lualine.setupOpts = {
|
|
|
|
# TODO: rewrite in new syntax
|
2024-07-10 23:07:04 +02:00
|
|
|
winbar.lualine_c = mkDefault [
|
2024-04-06 18:14:47 +02:00
|
|
|
[
|
|
|
|
"navic"
|
2024-09-13 16:26:03 +02:00
|
|
|
(mkLuaInline "draw_empty = ${boolToString bCfg.lualine.winbar.alwaysRender}")
|
2024-04-06 18:14:47 +02:00
|
|
|
]
|
2024-01-03 00:55:15 +01:00
|
|
|
];
|
|
|
|
};
|
|
|
|
})
|
|
|
|
(mkIf cfg.enable {
|
2024-05-15 11:51:07 +02:00
|
|
|
vim = {
|
|
|
|
startPlugins = ["lualine"];
|
2024-07-20 10:30:48 +02:00
|
|
|
pluginRC.lualine = entryAnywhere ''
|
2024-05-15 11:51:07 +02:00
|
|
|
local lualine = require('lualine')
|
|
|
|
lualine.setup ${toLuaObject cfg.setupOpts}
|
|
|
|
'';
|
2024-01-03 00:55:15 +01:00
|
|
|
|
2024-05-15 11:51:07 +02:00
|
|
|
# this is for backwards-compatibility
|
2024-07-10 23:07:04 +02:00
|
|
|
# NOTE: since lualine relies heavily on mixed list + key-value table syntax in lua e.g. {1, 2, three = 3}
|
|
|
|
# and we don't have a good syntax for that we're keeping the old options for now
|
2024-05-15 11:51:07 +02:00
|
|
|
statusline.lualine.setupOpts = {
|
|
|
|
options = {
|
2024-07-10 23:07:04 +02:00
|
|
|
icons_enabled = mkDefault cfg.icons.enable;
|
|
|
|
theme = mkDefault cfg.theme;
|
|
|
|
component_separators = mkDefault [cfg.componentSeparator.left cfg.componentSeparator.right];
|
|
|
|
section_separators = mkDefault [cfg.sectionSeparator.left cfg.sectionSeparator.right];
|
|
|
|
globalstatus = mkDefault cfg.globalStatus;
|
|
|
|
refresh = mkDefault cfg.refresh;
|
|
|
|
always_divide_middle = mkDefault cfg.alwaysDivideMiddle;
|
2024-05-15 11:51:07 +02:00
|
|
|
};
|
2024-01-26 19:16:56 +01:00
|
|
|
|
2024-05-15 11:51:07 +02:00
|
|
|
sections = {
|
2024-07-10 23:07:04 +02:00
|
|
|
lualine_a = mkDefault (map mkLuaInline (cfg.activeSection.a ++ cfg.extraActiveSection.a));
|
|
|
|
lualine_b = mkDefault (map mkLuaInline (cfg.activeSection.b ++ cfg.extraActiveSection.b));
|
|
|
|
lualine_c = mkDefault (map mkLuaInline (cfg.activeSection.c ++ cfg.extraActiveSection.c));
|
|
|
|
lualine_x = mkDefault (map mkLuaInline (cfg.activeSection.x ++ cfg.extraActiveSection.x));
|
|
|
|
lualine_y = mkDefault (map mkLuaInline (cfg.activeSection.y ++ cfg.extraActiveSection.y));
|
|
|
|
lualine_z = mkDefault (map mkLuaInline (cfg.activeSection.z ++ cfg.extraActiveSection.z));
|
2024-05-15 11:51:07 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
inactive_sections = {
|
2024-07-10 23:07:04 +02:00
|
|
|
lualine_a = mkDefault (map mkLuaInline (cfg.inactiveSection.a ++ cfg.extraInactiveSection.a));
|
|
|
|
lualine_b = mkDefault (map mkLuaInline (cfg.inactiveSection.b ++ cfg.extraInactiveSection.b));
|
|
|
|
lualine_c = mkDefault (map mkLuaInline (cfg.inactiveSection.c ++ cfg.extraInactiveSection.c));
|
|
|
|
lualine_x = mkDefault (map mkLuaInline (cfg.inactiveSection.x ++ cfg.extraInactiveSection.x));
|
|
|
|
lualine_y = mkDefault (map mkLuaInline (cfg.inactiveSection.y ++ cfg.extraInactiveSection.y));
|
|
|
|
lualine_z = mkDefault (map mkLuaInline (cfg.inactiveSection.z ++ cfg.extraInactiveSection.z));
|
2024-05-15 11:51:07 +02:00
|
|
|
};
|
2024-01-03 00:55:15 +01:00
|
|
|
};
|
|
|
|
};
|
|
|
|
})
|
|
|
|
];
|
2023-02-01 20:11:37 +01:00
|
|
|
}
|