58 lines
1.4 KiB
Nix
58 lines
1.4 KiB
Nix
{ config, lib, pkgs, ... }:
|
|
|
|
let
|
|
inherit (lib.nix2lua) var;
|
|
cfg = config.plugins.navigation.hop-nvim;
|
|
in
|
|
{
|
|
options.plugins.navigation.hop-nvim = with lib; {
|
|
enable = mkEnableOption "hop-nvim";
|
|
|
|
package = mkPackageOption pkgs.vimPlugins "hop-nvim" { };
|
|
|
|
settings = mkOption {
|
|
type = types.attrs;
|
|
default = { };
|
|
};
|
|
|
|
keymap.set = mkOption {
|
|
type = with types; functionTo (listOf keymap);
|
|
default = dir: [ ];
|
|
defaultText = literalExpression "dir: []";
|
|
example = literalExpression ''
|
|
{ after, before }: [
|
|
{ lhs = "<leader>hc"; rhs = "<cmd>HopChar1<cr>"; }
|
|
{
|
|
lhs = "<leader>hf";
|
|
rhs = lambda0 (call "hop.hint_char1" {
|
|
direction = after;
|
|
current_line_only = true;
|
|
});
|
|
}
|
|
{
|
|
lhs = "<leader>hF";
|
|
rhs = lambda0 (call "hop.hint_char1" {
|
|
direction = before;
|
|
current_line_only = true;
|
|
});
|
|
}
|
|
]
|
|
'';
|
|
};
|
|
};
|
|
|
|
config = lib.mkIf cfg.enable {
|
|
plugin.hop-nvim = {
|
|
name = "hop";
|
|
extraImports = { hop_hint = "hop.hint"; };
|
|
package = cfg.package;
|
|
setupSettings = cfg.settings;
|
|
};
|
|
|
|
vim.keymap.set = cfg.keymap.set {
|
|
after = var "hop_hint.HintDirection.AFTER_CURSOR";
|
|
before = var "hop_hint.HintDirection.BEFORE_CURSOR";
|
|
};
|
|
};
|
|
|
|
}
|