Skip to content

Commit

Permalink
plugins/easyescape: switch to mkVimPlugin and add options
Browse files Browse the repository at this point in the history
  • Loading branch information
GaetanLepage authored and nix-infra-bot committed Dec 15, 2024
1 parent a658e81 commit cb61e12
Show file tree
Hide file tree
Showing 2 changed files with 58 additions and 15 deletions.
48 changes: 33 additions & 15 deletions plugins/by-name/easyescape/default.nix
Original file line number Diff line number Diff line change
@@ -1,26 +1,44 @@
{
lib,
helpers,
config,
pkgs,
...
}:
with lib;
let
cfg = config.plugins.easyescape;
inherit (lib.nixvim) defaultNullOpts;
inherit (lib) types;
in
{
options = {
plugins.easyescape = {
enable = mkEnableOption "easyescape";
lib.nixvim.vim-plugin.mkVimPlugin {
name = "easyescape";
packPathName = "vim-easyescape";
package = "vim-easyescape";
globalPrefix = "easyescape_";

maintainers = [ lib.maintainers.GaetanLepage ];

package = lib.mkPackageOption pkgs "easyescape" {
default = [
"vimPlugins"
"vim-easyescape"
];
settingsOptions = {
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 ]; };
}
25 changes: 25 additions & 0 deletions tests/test-sources/plugins/by-name/easyescape/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,29 @@
empty = {
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;
};
};
};
}

0 comments on commit cb61e12

Please sign in to comment.