From b5f38b8e5ed2656854acdb69ed95fc65c6d43a20 Mon Sep 17 00:00:00 2001 From: NotAShelf Date: Wed, 15 May 2024 12:51:07 +0300 Subject: [PATCH 1/2] lualine: increase theme compatibility; fix component definitions --- modules/plugins/statusline/lualine/config.nix | 71 +++++----- .../plugins/statusline/lualine/lualine.nix | 130 ++++++++---------- 2 files changed, 96 insertions(+), 105 deletions(-) diff --git a/modules/plugins/statusline/lualine/config.nix b/modules/plugins/statusline/lualine/config.nix index 9578842..5479595 100644 --- a/modules/plugins/statusline/lualine/config.nix +++ b/modules/plugins/statusline/lualine/config.nix @@ -3,6 +3,7 @@ lib, ... }: let + inherit (builtins) map; inherit (lib.modules) mkIf mkMerge; inherit (lib.trivial) boolToString; inherit (lib.nvim.dag) entryAnywhere; @@ -31,44 +32,46 @@ in { }; }) (mkIf cfg.enable { - vim.startPlugins = [ - "lualine" - ]; + vim = { + startPlugins = ["lualine"]; - vim.luaConfigRC.lualine = entryAnywhere '' - local lualine = require('lualine') - lualine.setup ${toLuaObject cfg.setupOpts} - ''; + luaConfigRC.lualine = entryAnywhere '' + local lualine = require('lualine') + lualine.setup ${toLuaObject cfg.setupOpts} + ''; - # this is for backwards-compatibility - vim.statusline.lualine.setupOpts = { - options = { - icons_enabled = cfg.icons.enable; - theme = cfg.theme; - component_separators = [cfg.componentSeparator.left cfg.componentSeparator.right]; - section_separators = [cfg.sectionSeparator.left cfg.sectionSeparator.right]; - globalstatus = cfg.globalStatus; - refresh = cfg.refresh; - }; + # this is for backwards-compatibility + statusline.lualine.setupOpts = { + options = { + icons_enabled = cfg.icons.enable; + theme = cfg.theme; + component_separators = [cfg.componentSeparator.left cfg.componentSeparator.right]; + section_separators = [cfg.sectionSeparator.left cfg.sectionSeparator.right]; + globalstatus = cfg.globalStatus; + refresh = cfg.refresh; + }; - sections = { - lualine_a = builtins.map mkLuaInline (cfg.activeSection.a ++ cfg.extraActiveSection.a); - lualine_b = builtins.map mkLuaInline (cfg.activeSection.b ++ cfg.extraActiveSection.b); - lualine_c = builtins.map mkLuaInline (cfg.activeSection.c ++ cfg.extraActiveSection.c); - lualine_x = builtins.map mkLuaInline (cfg.activeSection.x ++ cfg.extraActiveSection.x); - lualine_y = builtins.map mkLuaInline (cfg.activeSection.y ++ cfg.extraActiveSection.y); - lualine_z = builtins.map mkLuaInline (cfg.activeSection.z ++ cfg.extraActiveSection.z); + sections = { + lualine_a = map mkLuaInline (cfg.activeSection.a ++ cfg.extraActiveSection.a); + lualine_b = map mkLuaInline (cfg.activeSection.b ++ cfg.extraActiveSection.b); + lualine_c = map mkLuaInline (cfg.activeSection.c ++ cfg.extraActiveSection.c); + lualine_x = map mkLuaInline (cfg.activeSection.x ++ cfg.extraActiveSection.x); + lualine_y = map mkLuaInline (cfg.activeSection.y ++ cfg.extraActiveSection.y); + lualine_z = map mkLuaInline (cfg.activeSection.z ++ cfg.extraActiveSection.z); + }; + + inactive_sections = { + lualine_a = map mkLuaInline (cfg.inactiveSection.a ++ cfg.extraInactiveSection.a); + lualine_b = map mkLuaInline (cfg.inactiveSection.b ++ cfg.extraInactiveSection.b); + lualine_c = map mkLuaInline (cfg.inactiveSection.c ++ cfg.extraInactiveSection.c); + lualine_x = map mkLuaInline (cfg.inactiveSection.x ++ cfg.extraInactiveSection.x); + lualine_y = map mkLuaInline (cfg.inactiveSection.y ++ cfg.extraInactiveSection.y); + lualine_z = map mkLuaInline (cfg.inactiveSection.z ++ cfg.extraInactiveSection.z); + }; + + # probably don't need this? + tabline = []; }; - inactive_sections = { - lualine_a = builtins.map mkLuaInline (cfg.inactiveSection.a ++ cfg.extraInactiveSection.a); - lualine_b = builtins.map mkLuaInline (cfg.inactiveSection.b ++ cfg.extraInactiveSection.b); - lualine_c = builtins.map mkLuaInline (cfg.inactiveSection.c ++ cfg.extraInactiveSection.c); - lualine_x = builtins.map mkLuaInline (cfg.inactiveSection.x ++ cfg.extraInactiveSection.x); - lualine_y = builtins.map mkLuaInline (cfg.inactiveSection.y ++ cfg.extraInactiveSection.y); - lualine_z = builtins.map mkLuaInline (cfg.inactiveSection.z ++ cfg.extraInactiveSection.z); - }; - # probably don't need this? - tabline = []; }; }) ]; diff --git a/modules/plugins/statusline/lualine/lualine.nix b/modules/plugins/statusline/lualine/lualine.nix index 7d1020f..bf77a82 100644 --- a/modules/plugins/statusline/lualine/lualine.nix +++ b/modules/plugins/statusline/lualine/lualine.nix @@ -10,19 +10,45 @@ inherit (lib.nvim.types) mkPluginSetupOption; supported_themes = import ./supported_themes.nix; - colorPuccin = - if config.vim.statusline.lualine.theme == "catppuccin" - then "#181825" - else "none"; + builtin_themes = [ + "auto" + "16color" + "gruvbox" + "ayu_dark" + "ayu_light" + "ayu_mirage" + "codedark" + "dracula" + "everforest" + "gruvbox" + "gruvbox_light" + "gruvbox_material" + "horizon" + "iceberg_dark" + "iceberg_light" + "jellybeans" + "material" + "modus_vivendi" + "molokai" + "nightfly" + "nord" + "oceanicnext" + "onelight" + "palenight" + "papercolor_dark" + "papercolor_light" + "powerline" + "seoul256" + "solarized_dark" + "tomorrow" + "wombat" + ]; in { options.vim.statusline.lualine = { + enable = mkEnableOption "lualine statusline plugin"; setupOpts = mkPluginSetupOption "Lualine" {}; - enable = mkEnableOption "lualine statusline plugin"; - - icons = { - enable = mkEnableOption "icons for lualine" // {default = true;}; - }; + icons.enable = mkEnableOption "icons for lualine" // {default = true;}; refresh = { statusline = mkOption { @@ -73,47 +99,15 @@ in { theme = let themeSupported = elem config.vim.theme.name supported_themes; + themesConcatted = builtin_themes ++ optional themeSupported config.vim.theme.name; in mkOption { - description = "Theme for lualine"; - type = enum ([ - "auto" - "16color" - "gruvbox" - "ayu_dark" - "ayu_light" - "ayu_mirage" - "codedark" - "dracula" - "everforest" - "gruvbox" - "gruvbox_light" - "gruvbox_material" - "horizon" - "iceberg_dark" - "iceberg_light" - "jellybeans" - "material" - "modus_vivendi" - "molokai" - "nightfly" - "nord" - "oceanicnext" - "onelight" - "palenight" - "papercolor_dark" - "papercolor_light" - "powerline" - "seoul256" - "solarized_dark" - "tomorrow" - "wombat" - ] - ++ optional themeSupported config.vim.theme.name); + type = enum themesConcatted; default = "auto"; # TODO: xml generation error if the closing '' is on a new line. # issue: https://gitlab.com/rycee/nmd/-/issues/10 defaultText = ''`config.vim.theme.name` if theme supports lualine else "auto"''; + description = "Theme for lualine"; }; sectionSeparator = { @@ -171,15 +165,14 @@ in { "filetype", colored = true, icon_only = true, - icon = { align = 'left' }, - color = {bg='${colorPuccin}', fg='lavender'}, + icon = { align = 'left' } } '' '' { "filename", - color = {bg='${colorPuccin}'}, - symbols = {modified = '', readonly = ''}, + symbols = {modified = ' ', readonly = ' '}, + separator = {right = ''} } '' ]; @@ -200,13 +193,7 @@ in { removed = 'DiffDelete', -- Changes the diff's removed color you }, symbols = {added = '+', modified = '~', removed = '-'}, -- Changes the diff symbols - color = { - bg='${colorPuccin}', - fg='lavender' - }, - separator = { - right = '' - }, + separator = {right = ''} } '' ]; @@ -251,10 +238,6 @@ in { return msg end, icon = ' ', - color = {bg='${colorPuccin}', fg='lavender'}, - separator = { - left = '', - }, } '' '' @@ -262,7 +245,6 @@ in { "diagnostics", sources = {'nvim_lsp', 'nvim_diagnostic', 'coc'}, symbols = {error = '󰅙 ', warn = ' ', info = ' ', hint = '󰌵 '}, - color = {bg='${colorPuccin}', fg='lavender'}, diagnostics_color = { color_error = { fg = 'red' }, color_warn = { fg = 'yellow' }, @@ -282,14 +264,16 @@ in { 'searchcount', maxcount = 999, timeout = 120, - color = {bg='${colorPuccin}', fg='lavender'} + } '' '' { "branch", icon = ' •', - color = {bg='${colorPuccin}', fg='lavender'}, + separator = { + left = '', + }, } '' ]; @@ -300,17 +284,10 @@ in { description = "active config for: | A | B | C X | Y | (Z) |"; default = [ '' - { - "progress", - separator = { - left = '', - }, - } + {"progress"} '' '' - { - "location", - } + {"location"} '' '' { @@ -326,32 +303,38 @@ in { ]; }; }; + extraActiveSection = { a = mkOption { type = listOf str; description = "Extra entries for activeSection.a"; default = []; }; + b = mkOption { type = listOf str; description = "Extra entries for activeSection.b"; default = []; }; + c = mkOption { type = listOf str; description = "Extra entries for activeSection.c"; default = []; }; + x = mkOption { type = listOf str; description = "Extra entries for activeSection.x"; default = []; }; + y = mkOption { type = listOf str; description = "Extra entries for activeSection.y"; default = []; }; + z = mkOption { type = listOf str; description = "Extra entries for activeSection.z"; @@ -402,26 +385,31 @@ in { description = "Extra entries for inactiveSection.a"; default = []; }; + b = mkOption { type = listOf str; description = "Extra entries for inactiveSection.b"; default = []; }; + c = mkOption { type = listOf str; description = "Extra entries for inactiveSection.c"; default = []; }; + x = mkOption { type = listOf str; description = "Extra entries for inactiveSection.x"; default = []; }; + y = mkOption { type = listOf str; description = "Extra entries for inactiveSection.y"; default = []; }; + z = mkOption { type = listOf str; description = "Extra entries for inactiveSection.z"; From 7cafa56cdba4b97df2b57b3ca88a9abe2f29f028 Mon Sep 17 00:00:00 2001 From: NotAShelf Date: Wed, 15 May 2024 12:53:19 +0300 Subject: [PATCH 2/2] docs: update 0.7 release notes --- docs/release-notes/rl-0.7.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/docs/release-notes/rl-0.7.md b/docs/release-notes/rl-0.7.md index 9c5d395..8f3ffd2 100644 --- a/docs/release-notes/rl-0.7.md +++ b/docs/release-notes/rl-0.7.md @@ -35,3 +35,6 @@ Release notes for release 0.7 to nixpkgs. A pull request is currently open. - Remove vim-tidal and friends + +- Cleaned up Lualine module to reduce theme dependency on Catppuccin, and fixed + blending issues in component separators.