nix-community.nixvim/plugins/utils/vim-bbye.nix
2023-05-22 23:00:53 +02:00

52 lines
1.1 KiB
Nix

{
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 (bdelete != null)
{
${bdelete} = {
action = ":Bdelete<CR>";
silent = cfg.keymapsSilent;
};
})
// (optionalAttrs (bwipeout != null)
{
${bwipeout} = {
action = ":Bwipeout<CR>";
silent = cfg.keymapsSilent;
};
});
};
}