Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

statusline/lualine: avoid hardcoding config options #201

Merged
merged 1 commit into from
Jan 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 14 additions & 6 deletions docs/release-notes/rl-0.6.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,14 @@ Release notes for release 0.6

- Fixed empty winbar when breadcrumbs are disabled

[donnerinoern](https://github.com/donnerinoern):

- Added Gruvbox theme

- Added marksman LSP for Markdown

- Fixed markdown preview with Glow not working and added an option for changing the preview keybind

[notashelf](https://github.com/notashelf):

- Finished moving to `nixosOptionsDoc` in the documentation and changelog. We are fully free of asciidoc now
Expand All @@ -25,10 +33,10 @@ Release notes for release 0.6
- Added support for css and tailwindcss through vscode-language-servers-extracted & tailwind-language-server.
Those can be enabled through `vim.languages.css` and `vim.languages.tailwind`

[donnerinoern](https://github.com/donnerinoern):

- Added Gruvbox theme

- Added marksman LSP for Markdown
- Lualine module now allows customizing `always_divide_middle`, `ignore_focus` and `disabled_filetypes` through the new
options: [vim.statusline.lualine.alwaysDivideMiddle](vim.statusline.lualine.alwaysDivideMiddle),
[vim.statusline.lualine.ignoreFocus](vim.statusline.lualine.ignoreFocus) and
[vim.statusline.lualine.disabledFiletypes](vim.statusline.lualine.disabledFiletypes)

- Fixed Markdown-previewer Glow not working and added an option for changing the preview keybind
- Updated all plugin inputs to their latest versions (26.01.2024) - this brought minor color changess to the Catppuccin
theme
13 changes: 9 additions & 4 deletions modules/statusline/lualine/config.nix
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,18 @@ in {
theme = "${cfg.theme}",
component_separators = {"${cfg.componentSeparator.left}","${cfg.componentSeparator.right}"},
section_separators = {"${cfg.sectionSeparator.left}","${cfg.sectionSeparator.right}"},
disabled_filetypes = { 'alpha' },
always_divide_middle = true,
disabled_filetypes = ${nvim.lua.listToLuaTable cfg.disabledFiletypes},
always_divide_middle = ${boolToString cfg.alwaysDivideMiddle},
globalstatus = ${boolToString cfg.globalStatus},
ignore_focus = {'NvimTree'},
ignore_focus = ${nvim.lua.listToLuaTable cfg.ignoreFocus},
extensions = {${optionalString config.vim.filetree.nvimTree.enable "'nvim-tree'"}},
refresh = {
statusline = ${toString cfg.refresh.statusline},
tabline = ${toString cfg.refresh.tabline},
winbar = ${toString cfg.refresh.winbar},
},
},

-- active sections
sections = {
lualine_a = ${nvim.lua.luaTable (cfg.activeSection.a ++ cfg.extraActiveSection.a)},
Expand All @@ -40,7 +41,8 @@ in {
lualine_y = ${nvim.lua.luaTable (cfg.activeSection.y ++ cfg.extraActiveSection.y)},
lualine_z = ${nvim.lua.luaTable (cfg.activeSection.z ++ cfg.extraActiveSection.z)},
},
--

-- inactive sections
inactive_sections = {
lualine_a = ${nvim.lua.luaTable (cfg.inactiveSection.a ++ cfg.extraInactiveSection.a)},
lualine_b = ${nvim.lua.luaTable (cfg.inactiveSection.b ++ cfg.extraInactiveSection.b)},
Expand All @@ -49,9 +51,12 @@ in {
lualine_y = ${nvim.lua.luaTable (cfg.inactiveSection.y ++ cfg.extraInactiveSection.y)},
lualine_z = ${nvim.lua.luaTable (cfg.inactiveSection.z ++ cfg.extraInactiveSection.z)},
},

-- tabline (currently unsupported)
tabline = {},

${optionalString (breadcrumbsCfg.enable && breadcrumbsCfg.source == "nvim-navic") ''
-- enable winbar if nvim-navic is enabled
winbar = {
lualine_c = {
{
Expand Down
29 changes: 29 additions & 0 deletions modules/statusline/lualine/lualine.nix
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,13 @@ in {
description = "Refresh rate for lualine";
default = 1000;
};

tabline = mkOption {
type = types.int;
description = "Refresh rate for tabline";
default = 1000;
};

winbar = mkOption {
type = types.int;
description = "Refresh rate for winbar";
Expand All @@ -42,6 +44,27 @@ in {
default = true;
};

alwaysDivideMiddle = mkOption {
type = types.bool;
description = "Always divide middle section";
default = true;
};

disabledFiletypes = mkOption {
type = with types; listOf str;
description = "Filetypes to disable lualine on";
default = ["alpha"];
};

ignoreFocus = mkOption {
type = with types; listOf str;
default = ["NvimTree"];
description = ''
If current filetype is in this list it'll always be drawn as inactive statusline
and the last window will be drawn as active statusline.
'';
};

theme = let
themeSupported = elem config.vim.theme.name supported_themes;
in
Expand Down Expand Up @@ -175,6 +198,9 @@ in {
bg='${colorPuccin}',
fg='lavender'
},
separator = {
right = ''
},
}
''
];
Expand Down Expand Up @@ -220,6 +246,9 @@ in {
end,
icon = ' ',
color = {bg='${colorPuccin}', fg='lavender'},
separator = {
left = '',
},
}
''
''
Expand Down
Loading