Skip to content

Commit

Permalink
Merge pull request #201 from NotAShelf/lualine-tweaks
Browse files Browse the repository at this point in the history
statusline/lualine: avoid hardcoding config options
  • Loading branch information
NotAShelf authored Jan 26, 2024
2 parents 894f2f4 + f94e6e1 commit 6fb2d67
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 10 deletions.
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

0 comments on commit 6fb2d67

Please sign in to comment.