Skip to content

Commit

Permalink
plugins/plantuml-syntax: migrate to mkVimPlugin
Browse files Browse the repository at this point in the history
  • Loading branch information
GaetanLepage authored and nix-infra-bot committed Dec 16, 2024
1 parent 471f68d commit 6c30476
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 33 deletions.
1 change: 0 additions & 1 deletion flake-modules/dev/list-plugins/list-plugins.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@ class State(Enum):
"plugins/by-name/lspkind/default.nix": (State.OLD, Kind.NEOVIM, False),
"plugins/by-name/nix-develop/default.nix": (State.OLD, Kind.NEOVIM, False),
"plugins/by-name/openscad/default.nix": (State.OLD, Kind.VIM, False),
"plugins/by-name/plantuml-syntax/default.nix": (State.OLD, Kind.VIM, False),
"plugins/by-name/rainbow-delimiters/default.nix": (State.OLD, Kind.NEOVIM, False),
"plugins/by-name/treesitter-refactor/default.nix": (State.OLD, Kind.MISC, True),
"plugins/by-name/treesitter-textobjects/default.nix": (
Expand Down
64 changes: 32 additions & 32 deletions plugins/by-name/plantuml-syntax/default.nix
Original file line number Diff line number Diff line change
@@ -1,44 +1,44 @@
{
lib,
helpers,
config,
pkgs,
...
}:
with lib;
{
options.plugins.plantuml-syntax = {
enable = mkEnableOption "plantuml syntax support";
let
inherit (lib.nixvim) defaultNullOpts;
in
lib.nixvim.vim-plugin.mkVimPlugin {
name = "plantuml-syntax";
globalPrefix = "plantuml_";

package = lib.mkPackageOption pkgs "plantuml-syntax" {
default = [
"vimPlugins"
"plantuml-syntax"
];
};
maintainers = [ lib.maintainers.GaetanLepage ];

setMakeprg = mkOption {
type = types.bool;
default = true;
description = "Set the makeprg to 'plantuml'";
};
executableScript = mkOption {
type = types.nullOr types.str;
default = null;
description = "Set the script to be called with makeprg, default to 'plantuml' in PATH";
# TODO introduced 2024-03-02: remove 2024-05-02
deprecateExtraConfig = true;
optionsRenamedToSettings = [
"setMakeprg"
"executableScript"
];

extraOptions = {
plantumlPackage = lib.mkPackageOption pkgs "plantuml" {
nullable = true;
};
};

config =
let
cfg = config.plugins.plantuml-syntax;
in
mkIf cfg.enable {
extraPlugins = [ cfg.package ];
extraConfig = cfg: { extraPackages = [ cfg.plantumlPackage ]; };

globals = {
plantuml_set_makeprg = cfg.setMakeprg;
plantuml_executable_script = cfg.executableScript;
};
};
settingsOptions = {
set_makeprg = defaultNullOpts.mkFlagInt 1 ''
Set the makeprg to `plantuml`.
'';

executable_script = defaultNullOpts.mkStr "plantuml" ''
Set the script to be called with makeprg, default to `plantuml` in `$PATH`.
'';
};

settingsExample = {
set_makeprg = true;
executable_script = "plantuml";
};
}
11 changes: 11 additions & 0 deletions tests/test-sources/plugins/by-name/plantuml-syntax/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,15 @@
empty = {
plugins.plantuml-syntax.enable = true;
};

defaults = {
plugins.plantuml-syntax = {
enable = true;

settings = {
set_makeprg = 1;
executable_script = "plantuml";
};
};
};
}

0 comments on commit 6c30476

Please sign in to comment.