diff --git a/flake.nix b/flake.nix index bfb8742d..c83f1b98 100644 --- a/flake.nix +++ b/flake.nix @@ -90,6 +90,7 @@ plugins.lspsaga.enable = true; plugins.treesitter.enable = true; + plugins.ledger.enable = true; }; }) ]; diff --git a/plugins/default.nix b/plugins/default.nix index df1ba3c2..93ad1fa8 100644 --- a/plugins/default.nix +++ b/plugins/default.nix @@ -21,6 +21,7 @@ ./languages/treesitter.nix ./languages/nix.nix + ./languages/ledger.nix ./nvim-lsp ./nvim-lsp/lspsaga.nix diff --git a/plugins/helpers.nix b/plugins/helpers.nix index bc1108e9..d75a97eb 100644 --- a/plugins/helpers.nix +++ b/plugins/helpers.nix @@ -87,10 +87,10 @@ rec { (if val == false then 0 else 1) else val; - mkDefaultOpt = { type, global, description ? null, example ? null, value ? v: toLuaObject (globalVal v), ... }: { + mkDefaultOpt = { type, global, description ? null, example ? null, default ? null, value ? v: toLuaObject (globalVal v), ... }: { option = mkOption { type = types.nullOr type; - default = null; + default = default; description = description; example = example; }; diff --git a/plugins/languages/ledger.nix b/plugins/languages/ledger.nix new file mode 100644 index 00000000..d5c6a06e --- /dev/null +++ b/plugins/languages/ledger.nix @@ -0,0 +1,33 @@ +{ pkgs, lib, ... }@args: +with lib; with import ../helpers.nix { lib = lib; }; +mkPlugin args { + name = "ledger"; + description = "Enable ledger language features"; + extraPlugins = [ pkgs.vimPlugins.vim-ledger ]; + + options = { + maxWidth = mkDefaultOpt { + global = "ledger_maxwidth"; + description = "Number of columns to display foldtext"; + type = types.int; + }; + + fillString = mkDefaultOpt { + global = "ledger_fillstring"; + description = "String used to fill the space between account name and amount in the foldtext"; + type = types.int; + }; + + detailedFirst = mkDefaultOpt { + global = "ledger_detailed_first"; + description = "Account completion sorted by depth instead of alphabetically"; + type = types.bool; + }; + + foldBlanks = mkDefaultOpt { + global = "ledger_fold_blanks"; + description = "Hide blank lines following a transaction on a fold"; + type = types.bool; + }; + }; +}