This repository has been archived on 2024-05-17. You can view files and clone it, but cannot push or open issues or pull requests.
neovim/modules/hop-nvim.nix

93 lines
2.1 KiB
Nix
Raw Normal View History

2024-04-21 11:46:13 +03:00
{ nix2lua, vim, ... }:
with nix2lua.lib;
let
hintDirAfter = var "hint.HintDirection.AFTER_CURSOR";
hintDirBefore = var "hint.HintDirection.BEFORE_CURSOR";
defaultKeymaps = [
{ mode = ""; bind = "<leader>hc"; command = "<CMD>HopChar1<CR>"; }
{
mode = "";
bind = "<leader>hf";
command = lambda0 (call "hop.hint_char1" {
direction = hintDirAfter;
current_line_only = true;
});
}
{
mode = "";
bind = "<leader>hF";
command = lambda0 (call "hop.hint_char1" {
direction = hintDirBefore;
current_line_only = true;
});
}
{
mode = "";
bind = "<leader>hbc";
command = lambda0 (call "hop.hint_char1" { direction = hintDirAfter; });
}
{
mode = "";
bind = "<leader>htc";
command = lambda0 (call "hop.hint_char1" { direction = hintDirBefore; });
}
{
mode = "";
bind = "<leader>hw";
command = "<Cmd>HopWord<CR>";
}
{
mode = "";
bind = "<leader>hbw";
command = lambda0 (call "hop.hint_words" { direction = hintDirAfter; });
}
{
mode = "";
bind = "<leader>htw";
command = lambda0 (call "hop.hint_words" { direction = hintDirBefore; });
}
{
mode = "";
bind = "<leader>hp";
command = "<CMD>HopPattern<CR>";
}
{
mode = "";
bind = "<leader>hbp";
command = lambda0 (call "hop.hint_patterns" { direction = hintDirAfter; });
}
{
mode = "";
bind = "<leader>htp";
command = lambda0 (call "hop.hint_patterns" { direction = hintDirBefore; });
}
{
mode = "";
bind = "<leader>hbv";
command = lambda0 (call "hop.hint_vertical" { direction = hintDirAfter; });
}
{
mode = "";
bind = "<leader>htv";
command = lambda0 (call "hop.hint_vertical" { direction = hintDirBefore; });
}
];
in
{ configs ? { }
, keymaps ? defaultKeymaps
, extraKeymaps ? [ ]
}:
{
hop-nvim = [
(local (set "hop" (require "hop")))
(pipe1 (var "hop") (call "setup" configs))
(local (set "hint" (require "hop.hint")))
] ++ map vim.keymap.set (keymaps ++ extraKeymaps);
}