plugins/easyescape: switch to mkVimPlugin and add options

This commit is contained in:
Gaetan Lepage 2024-12-15 18:04:49 +01:00 committed by nix-infra-bot
parent a658e81d71
commit cb61e12bba
2 changed files with 58 additions and 15 deletions

View file

@ -1,26 +1,44 @@
{ {
lib, lib,
helpers,
config,
pkgs,
... ...
}: }:
with lib;
let let
cfg = config.plugins.easyescape; inherit (lib.nixvim) defaultNullOpts;
inherit (lib) types;
in in
{ lib.nixvim.vim-plugin.mkVimPlugin {
options = { name = "easyescape";
plugins.easyescape = { packPathName = "vim-easyescape";
enable = mkEnableOption "easyescape"; package = "vim-easyescape";
globalPrefix = "easyescape_";
package = lib.mkPackageOption pkgs "easyescape" { maintainers = [ lib.maintainers.GaetanLepage ];
default = [
"vimPlugins" settingsOptions = {
"vim-easyescape" chars = defaultNullOpts.mkAttrsOf' {
]; type = types.ints.unsigned;
pluginDefault = {
j = 1;
k = 1;
}; };
example = {
j = 2;
}; };
description = ''
Which keys can be used to escape insert mode and how many times they need to be pressed.
'';
};
timeout = defaultNullOpts.mkUnsignedInt 100 ''
The unit of timeout is in ms.
A very small timeout makes an input of real `jk` or `kj` possible (Python3 is required for
this feature)!
'';
};
settingsExample = {
chars.j = 2;
timeout = 2000;
}; };
config = mkIf cfg.enable { extraPlugins = [ cfg.package ]; };
} }

View file

@ -2,4 +2,29 @@
empty = { empty = {
plugins.easyescape.enable = true; plugins.easyescape.enable = true;
}; };
defaults = {
plugins.easyescape = {
enable = true;
settings = {
chars = {
j = 1;
k = 1;
};
timeout = 100;
};
};
};
example = {
plugins.easyescape = {
enable = true;
settings = {
chars.j = 2;
timeout = 2000;
};
};
};
} }