mirror of
https://github.com/NotAShelf/nvf.git
synced 2024-11-23 05:40:44 +00:00
Merge pull request #173 from ksonj/lualine-options
statusline/lualine: extensible sections
This commit is contained in:
commit
30552a9ec3
4 changed files with 146 additions and 65 deletions
|
@ -89,3 +89,7 @@ https://github.com/ksonj[ksonj]:
|
||||||
* Removed redundant "Enable ..." in `mkEnableOption` descriptions
|
* Removed redundant "Enable ..." in `mkEnableOption` descriptions
|
||||||
|
|
||||||
* Add options to modify LSP key bindings and add proper whichkey descriptions
|
* Add options to modify LSP key bindings and add proper whichkey descriptions
|
||||||
|
|
||||||
|
* Changed type of `statusline.lualine.activeSection` and `statusline.lualine.inactiveSection` from `attrsOf str` to `attrsOf (listOf str)`
|
||||||
|
|
||||||
|
* Added `statusline.lualine.extraActiveSection` and `statusline.lualine.extraInactiveSection`
|
||||||
|
|
|
@ -44,4 +44,6 @@
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
+ " }";
|
+ " }";
|
||||||
|
# Convert a list of lua expressions to a lua table. The difference to listToLuaTable is that the elements here are expected to be lua expressions already, whereas listToLuaTable converts from nix types to lua first
|
||||||
|
luaTable = items: ''{${builtins.concatStringsSep "," items}}'';
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
}:
|
}:
|
||||||
with lib; let
|
with lib; let
|
||||||
cfg = config.vim.statusline.lualine;
|
cfg = config.vim.statusline.lualine;
|
||||||
|
inherit (nvim.lua) luaTable;
|
||||||
in {
|
in {
|
||||||
config = (mkIf cfg.enable) {
|
config = (mkIf cfg.enable) {
|
||||||
vim.startPlugins = [
|
vim.startPlugins = [
|
||||||
|
@ -32,21 +33,21 @@ in {
|
||||||
},
|
},
|
||||||
-- active sections
|
-- active sections
|
||||||
sections = {
|
sections = {
|
||||||
lualine_a = ${cfg.activeSection.a},
|
lualine_a = ${luaTable (cfg.activeSection.a ++ cfg.extraActiveSection.a)},
|
||||||
lualine_b = ${cfg.activeSection.b},
|
lualine_b = ${luaTable (cfg.activeSection.b ++ cfg.extraActiveSection.b)},
|
||||||
lualine_c = ${cfg.activeSection.c},
|
lualine_c = ${luaTable (cfg.activeSection.c ++ cfg.extraActiveSection.c)},
|
||||||
lualine_x = ${cfg.activeSection.x},
|
lualine_x = ${luaTable (cfg.activeSection.x ++ cfg.extraActiveSection.x)},
|
||||||
lualine_y = ${cfg.activeSection.y},
|
lualine_y = ${luaTable (cfg.activeSection.y ++ cfg.extraActiveSection.y)},
|
||||||
lualine_z = ${cfg.activeSection.z},
|
lualine_z = ${luaTable (cfg.activeSection.z ++ cfg.extraActiveSection.z)},
|
||||||
},
|
},
|
||||||
--
|
--
|
||||||
inactive_sections = {
|
inactive_sections = {
|
||||||
lualine_a = ${cfg.inactiveSection.a},
|
lualine_a = ${luaTable (cfg.inactiveSection.a ++ cfg.extraInactiveSection.a)},
|
||||||
lualine_b = ${cfg.inactiveSection.b},
|
lualine_b = ${luaTable (cfg.inactiveSection.b ++ cfg.extraInactiveSection.b)},
|
||||||
lualine_c = ${cfg.inactiveSection.c},
|
lualine_c = ${luaTable (cfg.inactiveSection.c ++ cfg.extraInactiveSection.c)},
|
||||||
lualine_x = ${cfg.inactiveSection.x},
|
lualine_x = ${luaTable (cfg.inactiveSection.x ++ cfg.extraInactiveSection.x)},
|
||||||
lualine_y = ${cfg.inactiveSection.y},
|
lualine_y = ${luaTable (cfg.inactiveSection.y ++ cfg.extraInactiveSection.y)},
|
||||||
lualine_z = ${cfg.inactiveSection.z},
|
lualine_z = ${luaTable (cfg.inactiveSection.z ++ cfg.extraInactiveSection.z)},
|
||||||
},
|
},
|
||||||
tabline = {},
|
tabline = {},
|
||||||
|
|
||||||
|
|
|
@ -117,10 +117,10 @@ in {
|
||||||
|
|
||||||
activeSection = {
|
activeSection = {
|
||||||
a = mkOption {
|
a = mkOption {
|
||||||
type = types.str;
|
type = with types; listOf str;
|
||||||
description = "active config for: | (A) | B | C X | Y | Z |";
|
description = "active config for: | (A) | B | C X | Y | Z |";
|
||||||
default = ''
|
default = [
|
||||||
{
|
''
|
||||||
{
|
{
|
||||||
"mode",
|
"mode",
|
||||||
icons_enabled = true,
|
icons_enabled = true,
|
||||||
|
@ -128,37 +128,39 @@ in {
|
||||||
left = '▎',
|
left = '▎',
|
||||||
right = ''
|
right = ''
|
||||||
},
|
},
|
||||||
},
|
}
|
||||||
}
|
''
|
||||||
'';
|
];
|
||||||
};
|
};
|
||||||
|
|
||||||
b = mkOption {
|
b = mkOption {
|
||||||
type = types.str;
|
type = with types; listOf str;
|
||||||
description = "active config for: | A | (B) | C X | Y | Z |";
|
description = "active config for: | A | (B) | C X | Y | Z |";
|
||||||
default = ''
|
default = [
|
||||||
{
|
''
|
||||||
{
|
{
|
||||||
"filetype",
|
"filetype",
|
||||||
colored = true,
|
colored = true,
|
||||||
icon_only = true,
|
icon_only = true,
|
||||||
icon = { align = 'left' },
|
icon = { align = 'left' },
|
||||||
color = {bg='${colorPuccin}', fg='lavender'},
|
color = {bg='${colorPuccin}', fg='lavender'},
|
||||||
},
|
}
|
||||||
|
''
|
||||||
|
''
|
||||||
{
|
{
|
||||||
"filename",
|
"filename",
|
||||||
color = {bg='${colorPuccin}'},
|
color = {bg='${colorPuccin}'},
|
||||||
symbols = {modified = '', readonly = ''},
|
symbols = {modified = '', readonly = ''},
|
||||||
},
|
}
|
||||||
}
|
''
|
||||||
'';
|
];
|
||||||
};
|
};
|
||||||
|
|
||||||
c = mkOption {
|
c = mkOption {
|
||||||
type = types.str;
|
type = with types; listOf str;
|
||||||
description = "active config for: | A | B | (C) X | Y | Z |";
|
description = "active config for: | A | B | (C) X | Y | Z |";
|
||||||
default = ''
|
default = [
|
||||||
{
|
''
|
||||||
{
|
{
|
||||||
"diff",
|
"diff",
|
||||||
colored = false,
|
colored = false,
|
||||||
|
@ -173,16 +175,16 @@ in {
|
||||||
bg='${colorPuccin}',
|
bg='${colorPuccin}',
|
||||||
fg='lavender'
|
fg='lavender'
|
||||||
},
|
},
|
||||||
},
|
}
|
||||||
}
|
''
|
||||||
'';
|
];
|
||||||
};
|
};
|
||||||
|
|
||||||
x = mkOption {
|
x = mkOption {
|
||||||
type = types.str;
|
type = with types; listOf str;
|
||||||
description = "active config for: | A | B | C (X) | Y | Z |";
|
description = "active config for: | A | B | C (X) | Y | Z |";
|
||||||
default = ''
|
default = [
|
||||||
{
|
''
|
||||||
{
|
{
|
||||||
-- Lsp server name
|
-- Lsp server name
|
||||||
function()
|
function()
|
||||||
|
@ -218,7 +220,9 @@ in {
|
||||||
end,
|
end,
|
||||||
icon = ' ',
|
icon = ' ',
|
||||||
color = {bg='${colorPuccin}', fg='lavender'},
|
color = {bg='${colorPuccin}', fg='lavender'},
|
||||||
},
|
}
|
||||||
|
''
|
||||||
|
''
|
||||||
{
|
{
|
||||||
"diagnostics",
|
"diagnostics",
|
||||||
sources = {'nvim_lsp', 'nvim_diagnostic', 'coc'},
|
sources = {'nvim_lsp', 'nvim_diagnostic', 'coc'},
|
||||||
|
@ -229,45 +233,51 @@ in {
|
||||||
color_warn = { fg = 'yellow' },
|
color_warn = { fg = 'yellow' },
|
||||||
color_info = { fg = 'cyan' },
|
color_info = { fg = 'cyan' },
|
||||||
},
|
},
|
||||||
},
|
}
|
||||||
}
|
''
|
||||||
'';
|
];
|
||||||
};
|
};
|
||||||
|
|
||||||
y = mkOption {
|
y = mkOption {
|
||||||
type = types.str;
|
type = with types; listOf str;
|
||||||
description = "active config for: | A | B | C X | (Y) | Z |";
|
description = "active config for: | A | B | C X | (Y) | Z |";
|
||||||
default = ''
|
default = [
|
||||||
{
|
''
|
||||||
{
|
{
|
||||||
'searchcount',
|
'searchcount',
|
||||||
maxcount = 999,
|
maxcount = 999,
|
||||||
timeout = 120,
|
timeout = 120,
|
||||||
color = {bg='${colorPuccin}', fg='lavender'}
|
color = {bg='${colorPuccin}', fg='lavender'}
|
||||||
},
|
}
|
||||||
|
''
|
||||||
|
''
|
||||||
{
|
{
|
||||||
"branch",
|
"branch",
|
||||||
icon = ' •',
|
icon = ' •',
|
||||||
color = {bg='${colorPuccin}', fg='lavender'},
|
color = {bg='${colorPuccin}', fg='lavender'},
|
||||||
},
|
}
|
||||||
}
|
''
|
||||||
'';
|
];
|
||||||
};
|
};
|
||||||
|
|
||||||
z = mkOption {
|
z = mkOption {
|
||||||
type = types.str;
|
type = with types; listOf str;
|
||||||
description = "active config for: | A | B | C X | Y | (Z) |";
|
description = "active config for: | A | B | C X | Y | (Z) |";
|
||||||
default = ''
|
default = [
|
||||||
{
|
''
|
||||||
{
|
{
|
||||||
"progress",
|
"progress",
|
||||||
separator = {
|
separator = {
|
||||||
left = '',
|
left = '',
|
||||||
},
|
},
|
||||||
},
|
}
|
||||||
|
''
|
||||||
|
''
|
||||||
{
|
{
|
||||||
"location",
|
"location",
|
||||||
},
|
}
|
||||||
|
''
|
||||||
|
''
|
||||||
{
|
{
|
||||||
"fileformat",
|
"fileformat",
|
||||||
color = {fg='black'},
|
color = {fg='black'},
|
||||||
|
@ -276,47 +286,111 @@ in {
|
||||||
dos = '', -- e70f
|
dos = '', -- e70f
|
||||||
mac = '', -- e711
|
mac = '', -- e711
|
||||||
},
|
},
|
||||||
},
|
}
|
||||||
}
|
''
|
||||||
'';
|
];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
extraActiveSection = {
|
||||||
|
a = mkOption {
|
||||||
|
type = with types; listOf str;
|
||||||
|
description = "Extra entries for activeSection.a";
|
||||||
|
default = [];
|
||||||
|
};
|
||||||
|
b = mkOption {
|
||||||
|
type = with types; listOf str;
|
||||||
|
description = "Extra entries for activeSection.b";
|
||||||
|
default = [];
|
||||||
|
};
|
||||||
|
c = mkOption {
|
||||||
|
type = with types; listOf str;
|
||||||
|
description = "Extra entries for activeSection.c";
|
||||||
|
default = [];
|
||||||
|
};
|
||||||
|
x = mkOption {
|
||||||
|
type = with types; listOf str;
|
||||||
|
description = "Extra entries for activeSection.x";
|
||||||
|
default = [];
|
||||||
|
};
|
||||||
|
y = mkOption {
|
||||||
|
type = with types; listOf str;
|
||||||
|
description = "Extra entries for activeSection.y";
|
||||||
|
default = [];
|
||||||
|
};
|
||||||
|
z = mkOption {
|
||||||
|
type = with types; listOf str;
|
||||||
|
description = "Extra entries for activeSection.z";
|
||||||
|
default = [];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
inactiveSection = {
|
inactiveSection = {
|
||||||
a = mkOption {
|
a = mkOption {
|
||||||
type = types.str;
|
type = with types; listOf str;
|
||||||
description = "inactive config for: | (A) | B | C X | Y | Z |";
|
description = "inactive config for: | (A) | B | C X | Y | Z |";
|
||||||
default = "{}";
|
default = [];
|
||||||
};
|
};
|
||||||
|
|
||||||
b = mkOption {
|
b = mkOption {
|
||||||
type = types.str;
|
type = with types; listOf str;
|
||||||
description = "inactive config for: | A | (B) | C X | Y | Z |";
|
description = "inactive config for: | A | (B) | C X | Y | Z |";
|
||||||
default = "{}";
|
default = [];
|
||||||
};
|
};
|
||||||
|
|
||||||
c = mkOption {
|
c = mkOption {
|
||||||
type = types.str;
|
type = with types; listOf str;
|
||||||
description = "inactive config for: | A | B | (C) X | Y | Z |";
|
description = "inactive config for: | A | B | (C) X | Y | Z |";
|
||||||
default = "{'filename'}";
|
default = ["'filename'"];
|
||||||
};
|
};
|
||||||
|
|
||||||
x = mkOption {
|
x = mkOption {
|
||||||
type = types.str;
|
type = with types; listOf str;
|
||||||
description = "inactive config for: | A | B | C (X) | Y | Z |";
|
description = "inactive config for: | A | B | C (X) | Y | Z |";
|
||||||
default = "{'location'}";
|
default = ["'location'"];
|
||||||
};
|
};
|
||||||
|
|
||||||
y = mkOption {
|
y = mkOption {
|
||||||
type = types.str;
|
type = with types; listOf str;
|
||||||
description = "inactive config for: | A | B | C X | (Y) | Z |";
|
description = "inactive config for: | A | B | C X | (Y) | Z |";
|
||||||
default = "{}";
|
default = [];
|
||||||
};
|
};
|
||||||
|
|
||||||
z = mkOption {
|
z = mkOption {
|
||||||
type = types.str;
|
type = with types; listOf str;
|
||||||
description = "inactive config for: | A | B | C X | Y | (Z) |";
|
description = "inactive config for: | A | B | C X | Y | (Z) |";
|
||||||
default = "{}";
|
default = [];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
extraInactiveSection = {
|
||||||
|
a = mkOption {
|
||||||
|
type = with types; listOf str;
|
||||||
|
description = "Extra entries for inactiveSection.a";
|
||||||
|
default = [];
|
||||||
|
};
|
||||||
|
b = mkOption {
|
||||||
|
type = with types; listOf str;
|
||||||
|
description = "Extra entries for inactiveSection.b";
|
||||||
|
default = [];
|
||||||
|
};
|
||||||
|
c = mkOption {
|
||||||
|
type = with types; listOf str;
|
||||||
|
description = "Extra entries for inactiveSection.c";
|
||||||
|
default = [];
|
||||||
|
};
|
||||||
|
x = mkOption {
|
||||||
|
type = with types; listOf str;
|
||||||
|
description = "Extra entries for inactiveSection.x";
|
||||||
|
default = [];
|
||||||
|
};
|
||||||
|
y = mkOption {
|
||||||
|
type = with types; listOf str;
|
||||||
|
description = "Extra entries for inactiveSection.y";
|
||||||
|
default = [];
|
||||||
|
};
|
||||||
|
z = mkOption {
|
||||||
|
type = with types; listOf str;
|
||||||
|
description = "Extra entries for inactiveSection.z";
|
||||||
|
default = [];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue