mirror of
https://github.com/nix-community/nixvim.git
synced 2025-07-02 05:14:30 +02:00
plugins/vim-bbye: init + tests (#248)
This commit is contained in:
parent
cf3f10265b
commit
883703328d
3 changed files with 71 additions and 0 deletions
|
@ -76,6 +76,7 @@
|
||||||
./utils/surround.nix
|
./utils/surround.nix
|
||||||
./utils/todo-comments.nix
|
./utils/todo-comments.nix
|
||||||
./utils/undotree.nix
|
./utils/undotree.nix
|
||||||
|
./utils/vim-bbye.nix
|
||||||
./utils/vim-matchup.nix
|
./utils/vim-matchup.nix
|
||||||
./utils/dashboard.nix
|
./utils/dashboard.nix
|
||||||
./utils/emmet.nix
|
./utils/emmet.nix
|
||||||
|
|
52
plugins/utils/vim-bbye.nix
Normal file
52
plugins/utils/vim-bbye.nix
Normal file
|
@ -0,0 +1,52 @@
|
||||||
|
{
|
||||||
|
pkgs,
|
||||||
|
config,
|
||||||
|
lib,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
with lib; let
|
||||||
|
cfg = config.plugins.vim-bbye;
|
||||||
|
helpers = import ../helpers.nix {inherit lib;};
|
||||||
|
in {
|
||||||
|
options.plugins.vim-bbye = {
|
||||||
|
enable = mkEnableOption "vim-bbye";
|
||||||
|
|
||||||
|
package = helpers.mkPackageOption "vim-bbye" pkgs.vimPlugins.vim-bbye;
|
||||||
|
|
||||||
|
keymapsSilent = mkOption {
|
||||||
|
type = types.bool;
|
||||||
|
description = "Whether vim-bbye keymaps should be silent.";
|
||||||
|
default = false;
|
||||||
|
};
|
||||||
|
|
||||||
|
keymaps = {
|
||||||
|
bdelete = helpers.mkNullOrOption types.str ''
|
||||||
|
Keymap for deleting the current buffer.";
|
||||||
|
'';
|
||||||
|
|
||||||
|
bwipeout = helpers.mkNullOrOption types.str ''
|
||||||
|
Keymap for completely deleting the current buffer.";
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
config = mkIf cfg.enable {
|
||||||
|
extraPlugins = [cfg.package];
|
||||||
|
|
||||||
|
maps.normal = with cfg.keymaps;
|
||||||
|
(optionalAttrs (!isNull bdelete)
|
||||||
|
{
|
||||||
|
${bdelete} = {
|
||||||
|
action = ":Bdelete<CR>";
|
||||||
|
silent = cfg.keymapsSilent;
|
||||||
|
};
|
||||||
|
})
|
||||||
|
// (optionalAttrs (!isNull bwipeout)
|
||||||
|
{
|
||||||
|
${bwipeout} = {
|
||||||
|
action = ":Bwipeout<CR>";
|
||||||
|
silent = cfg.keymapsSilent;
|
||||||
|
};
|
||||||
|
});
|
||||||
|
};
|
||||||
|
}
|
18
tests/plugins/vim-bbye.nix
Normal file
18
tests/plugins/vim-bbye.nix
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
{
|
||||||
|
empty = {
|
||||||
|
plugins.vim-bbye.enable = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
test = {
|
||||||
|
plugins.vim-bbye = {
|
||||||
|
enable = true;
|
||||||
|
|
||||||
|
keymapsSilent = false;
|
||||||
|
|
||||||
|
keymaps = {
|
||||||
|
bdelete = "<C-w>";
|
||||||
|
bwipeout = "<C-t>";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
Loading…
Add table
Add a link
Reference in a new issue