diff --git a/flake.nix b/flake.nix index f97bf7a9..b2b48c18 100644 --- a/flake.nix +++ b/flake.nix @@ -31,7 +31,7 @@ programs.nixvim = { enable = true; package = pkgs.neovim-nightly; - colorschemes.onedark = { enable = true; }; + colorschemes.tokyonight = { enable = true; }; extraPlugins = [ pkgs.vimPlugins.vim-nix ]; @@ -50,9 +50,8 @@ maps.normalVisualOp."รง" = ":"; - plugins.airline = { + plugins.lualine = { enable = true; - powerline = true; }; plugins.undotree.enable = true; diff --git a/plugins/statuslines/lualine.nix b/plugins/statuslines/lualine.nix index 6c970225..5f0f6aa6 100644 --- a/plugins/statuslines/lualine.nix +++ b/plugins/statuslines/lualine.nix @@ -46,35 +46,30 @@ let in { options = { programs.nixvim.plugins.lualine = { - enable = mkEnableOption "Enable airline"; + enable = mkEnableOption "Enable lualine"; - options = mkOption { - type = types.submodule { - options = { - theme = mkOption { - default = "auto"; - type = types.str; - description = "The theme to use for lualine-nvim."; - }; - section_separators = separators; - component_separators = separators; - disabled_filestypes = mkOption { - type = types.listOf types.str; - default = [ ]; - example = ''[ "lua" ]''; - description = "filetypes to disable lualine on"; - }; - always_divide_middle = mkOption { - type = types.bool; - default = true; - description = - "When true left_sections (a,b,c) can't take over entire statusline"; - }; - }; - }; - default = { }; - description = "Options for lualine"; + theme = mkOption { + default = "auto"; + type = types.str; + description = "The theme to use for lualine-nvim."; }; + + sectionSeparators = separators; + componentSeparators = separators; + + disabledFilestypes = mkOption { + type = types.listOf types.str; + default = [ ]; + example = ''[ "lua" ]''; + description = "filetypes to disable lualine on"; + }; + + alwaysDivideMiddle = mkOption { + type = types.bool; + default = true; + description = "When true, left_sections (a,b,c) can't take over entire statusline"; + }; + sections = mkOption { type = types.nullOr (types.submodule ({ ... }: { options = { @@ -87,8 +82,10 @@ in { lualine_z = component_options "location"; }; })); + default = { }; }; + tabline = mkOption { type = types.nullOr (types.submodule ({ ... }: { options = { @@ -111,19 +108,24 @@ in { }; }; }; - config = mkIf cfg.enable { + config = let + setupOptions = { + options = { + theme = cfg.theme; + section_separators = cfg.sectionSeparators; + component_separators = cfg.componentSeparators; + disabled_filestypes = cfg.disabledFilestypes; + always_divide_middle = cfg.alwaysDivideMiddle; + }; + + sections = cfg.sections; + tabline = cfg.tabline; + extensions = cfg.extensions; + }; + in mkIf cfg.enable { programs.nixvim = { extraPlugins = [ pkgs.vimPlugins.lualine-nvim ]; - extraConfigLua = ''require("lualine").setup{'' - + optionalString (cfg.options != { }) '' - options = ${helpers.toLuaObject cfg.options}; - '' + optionalString (cfg.sections != { }) '' - sections = ${helpers.toLuaObject cfg.sections}; - '' + optionalString (!isNull cfg.tabline) '' - tabline = ${helpers.toLuaObject cfg.tabline}; - '' + optionalString (cfg.extensions != [ ]) '' - extensions = ${helpers.toLuaObject cfg.extensions}; - '' + "}"; + extraConfigLua = ''require("lualine").setup(${helpers.toLuaObject setupOptions})''; }; }; }