Skip to content

Commit

Permalink
ledger: init plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
pta2002 committed Mar 18, 2021
1 parent c3fc078 commit 5ffa2b4
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 2 deletions.
1 change: 1 addition & 0 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@
plugins.lspsaga.enable = true;

plugins.treesitter.enable = true;
plugins.ledger.enable = true;
};
})
];
Expand Down
1 change: 1 addition & 0 deletions plugins/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@

./languages/treesitter.nix
./languages/nix.nix
./languages/ledger.nix

./nvim-lsp
./nvim-lsp/lspsaga.nix
Expand Down
4 changes: 2 additions & 2 deletions plugins/helpers.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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;
};
Expand Down
33 changes: 33 additions & 0 deletions plugins/languages/ledger.nix
Original file line number Diff line number Diff line change
@@ -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;
};
};
}

0 comments on commit 5ffa2b4

Please sign in to comment.