nix-community.nixvim/plugins/by-name/vim-bbye/default.nix

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

51 lines
1.1 KiB
Nix
Raw Normal View History

2023-03-14 15:21:35 +01:00
{
lib,
...
}:
let
inherit (lib.nixvim) mkNullOrOption;
inherit (lib) types;
2023-03-14 15:21:35 +01:00
in
2024-12-22 09:58:27 +00:00
lib.nixvim.plugins.mkVimPlugin {
name = "vim-bbye";
2023-03-14 15:21:35 +01:00
maintainers = [ lib.maintainers.GaetanLepage ];
2023-03-14 15:21:35 +01:00
extraOptions = {
keymapsSilent = lib.mkOption {
2023-03-14 15:21:35 +01:00
type = types.bool;
description = "Whether vim-bbye keymaps should be silent.";
default = false;
};
keymaps = {
bdelete = mkNullOrOption types.str ''
2023-03-14 15:21:35 +01:00
Keymap for deleting the current buffer.";
'';
bwipeout = mkNullOrOption types.str ''
2023-03-14 15:21:35 +01:00
Keymap for completely deleting the current buffer.";
'';
};
};
extraConfig = cfg: {
keymaps =
lib.nixvim.keymaps.mkKeymaps
{
mode = "n";
options.silent = cfg.keymapsSilent;
}
(
(lib.optional (cfg.keymaps.bdelete != null) {
key = cfg.keymaps.bdelete;
2023-03-14 15:21:35 +01:00
action = ":Bdelete<CR>";
})
++ (lib.optional (cfg.keymaps.bwipeout != null) {
key = cfg.keymaps.bwipeout;
2023-03-14 15:21:35 +01:00
action = ":Bwipeout<CR>";
})
);
2023-03-14 15:21:35 +01:00
};
}