nix-community.nixvim/plugins/utils/vim-bbye.nix

57 lines
1.1 KiB
Nix
Raw Normal View History

2023-03-14 15:21:35 +01:00
{
lib,
helpers,
config,
pkgs,
2023-03-14 15:21:35 +01:00
...
}:
2024-05-05 19:39:35 +02:00
with lib;
let
2023-03-14 15:21:35 +01:00
cfg = config.plugins.vim-bbye;
2024-05-05 19:39:35 +02:00
in
{
2023-03-14 15:21:35 +01:00
options.plugins.vim-bbye = {
enable = mkEnableOption "vim-bbye";
package = helpers.mkPluginPackageOption "vim-bbye" pkgs.vimPlugins.vim-bbye;
2023-03-14 15:21:35 +01:00
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 {
2024-05-05 19:39:35 +02:00
extraPlugins = [ cfg.package ];
2023-03-14 15:21:35 +01:00
2024-05-05 19:39:35 +02:00
keymaps =
with cfg.keymaps;
helpers.keymaps.mkKeymaps
2024-05-05 19:39:35 +02:00
{
mode = "n";
options.silent = cfg.keymapsSilent;
}
(
2024-05-05 19:39:35 +02:00
(optional (bdelete != null) {
key = bdelete;
2023-03-14 15:21:35 +01:00
action = ":Bdelete<CR>";
2024-05-05 19:39:35 +02:00
})
++ (optional (bwipeout != null) {
key = bwipeout;
2023-03-14 15:21:35 +01:00
action = ":Bwipeout<CR>";
2024-05-05 19:39:35 +02:00
})
);
2023-03-14 15:21:35 +01:00
};
}