2023-02-01 19:11:37 +00:00
|
|
|
{
|
|
|
|
config,
|
|
|
|
lib,
|
|
|
|
...
|
2023-11-07 00:50:27 +00:00
|
|
|
}: let
|
2024-05-15 09:51:07 +00:00
|
|
|
inherit (builtins) map;
|
2024-07-10 21:07:04 +00:00
|
|
|
inherit (lib.modules) mkIf mkMerge mkDefault;
|
2024-03-12 00:47:57 +00:00
|
|
|
inherit (lib.trivial) boolToString;
|
|
|
|
inherit (lib.nvim.dag) entryAnywhere;
|
2024-03-16 09:29:32 +00:00
|
|
|
inherit (lib.nvim.lua) toLuaObject;
|
|
|
|
inherit (lib.generators) mkLuaInline;
|
2024-03-12 00:47:57 +00:00
|
|
|
|
2023-03-01 12:22:41 +00:00
|
|
|
cfg = config.vim.statusline.lualine;
|
2024-09-13 17:54:08 +00:00
|
|
|
bCfg = config.vim.ui.breadcrumbs;
|
2023-03-01 12:22:41 +00:00
|
|
|
in {
|
2024-01-02 23:55:15 +00:00
|
|
|
config = mkMerge [
|
|
|
|
# TODO: move into nvim-tree file
|
2024-07-08 21:57:58 +00:00
|
|
|
(mkIf config.vim.filetree.nvimTree.enable {
|
2024-01-02 23:55:15 +00:00
|
|
|
vim.statusline.lualine.setupOpts = {
|
|
|
|
extensions = ["nvim-tree"];
|
|
|
|
};
|
|
|
|
})
|
2024-09-13 17:54:08 +00:00
|
|
|
|
|
|
|
(mkIf (bCfg.enable && bCfg.lualine.winbar.enable && bCfg.source == "nvim-navic") {
|
2024-01-02 23:55:15 +00:00
|
|
|
vim.statusline.lualine.setupOpts = {
|
|
|
|
# TODO: rewrite in new syntax
|
2024-07-10 21:07:04 +00:00
|
|
|
winbar.lualine_c = mkDefault [
|
2024-04-06 16:14:47 +00:00
|
|
|
[
|
|
|
|
"navic"
|
2024-09-13 17:54:08 +00:00
|
|
|
(mkLuaInline "draw_empty = ${boolToString bCfg.lualine.winbar.alwaysRender}")
|
2024-04-06 16:14:47 +00:00
|
|
|
]
|
2024-01-02 23:55:15 +00:00
|
|
|
];
|
|
|
|
};
|
|
|
|
})
|
|
|
|
(mkIf cfg.enable {
|
2024-05-15 09:51:07 +00:00
|
|
|
vim = {
|
|
|
|
startPlugins = ["lualine"];
|
2024-07-20 08:30:48 +00:00
|
|
|
pluginRC.lualine = entryAnywhere ''
|
2024-05-15 09:51:07 +00:00
|
|
|
local lualine = require('lualine')
|
|
|
|
lualine.setup ${toLuaObject cfg.setupOpts}
|
|
|
|
'';
|
2024-01-02 23:55:15 +00:00
|
|
|
|
2024-05-15 09:51:07 +00:00
|
|
|
# this is for backwards-compatibility
|
2024-07-10 21:07:04 +00: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 09:51:07 +00:00
|
|
|
statusline.lualine.setupOpts = {
|
|
|
|
options = {
|
2024-07-10 21:07:04 +00: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 09:51:07 +00:00
|
|
|
};
|
2024-01-26 18:16:56 +00:00
|
|
|
|
2024-05-15 09:51:07 +00:00
|
|
|
sections = {
|
2024-07-10 21:07:04 +00: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 09:51:07 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
inactive_sections = {
|
2024-07-10 21:07:04 +00: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 09:51:07 +00:00
|
|
|
};
|
2024-01-02 23:55:15 +00:00
|
|
|
};
|
|
|
|
};
|
|
|
|
})
|
|
|
|
];
|
2023-02-01 19:11:37 +00:00
|
|
|
}
|