diff --git a/modules/plugins/terminal/toggleterm/toggleterm.nix b/modules/plugins/terminal/toggleterm/toggleterm.nix index 6b443b9e..bc4cdb51 100644 --- a/modules/plugins/terminal/toggleterm/toggleterm.nix +++ b/modules/plugins/terminal/toggleterm/toggleterm.nix @@ -4,8 +4,8 @@ lib, ... }: let - inherit (lib.options) mkOption mkEnableOption; - inherit (lib.types) nullOr enum bool package either int; + inherit (lib.options) mkOption mkEnableOption literalExpression; + inherit (lib.types) nullOr enum package either int; inherit (lib.modules) mkRenamedOptionModule; inherit (lib.nvim.types) mkPluginSetupOption luaInline; inherit (lib.generators) mkLuaInline; @@ -29,15 +29,10 @@ in { description = "Direction of the terminal"; }; - enable_winbar = mkOption { - type = bool; - default = false; - description = "Enable winbar"; - }; + enable_winbar = mkEnableOption "winbar"; size = mkOption { type = either luaInline int; - description = "Number or lua function which is passed to the current terminal"; default = mkLuaInline '' function(term) if term.direction == "horizontal" then @@ -47,17 +42,38 @@ in { end end ''; + defaultText = literalExpression '' + mkLuaInline ''' + function(term) + if term.direction == "horizontal" then + return 15 + elseif term.direction == "vertical" then + return vim.o.columns * 0.4 + end + end + ''' + ''; + description = "Integer or Lua function which is passed to the current terminal"; }; + winbar = { enabled = mkEnableOption "winbar in terminal" // {default = true;}; name_formatter = mkOption { type = luaInline; - description = "Winbar formatter function."; default = mkLuaInline '' function(term) return term.name end ''; + defaultText = + literalExpression + mkLuaInline '' ' + function(term) + return term.name + end + ''' + ''; + description = "Winbar formatter function."; }; }; }; @@ -73,7 +89,14 @@ in { package = mkOption { type = nullOr package; default = pkgs.lazygit; - description = "The package that should be used for lazygit. Setting it to null will attempt to use lazygit from your PATH"; + defaultText = literalExpression "pkgs.lazygit"; + description = '' + The package that should be used for lazygit. + + Setting this option to `null` will instead attemp to use `lazygit` + from your {env}`PATH` + + ''; }; mappings = {