50 lines
1.3 KiB
Nix
50 lines
1.3 KiB
Nix
{
|
|
pkgs,
|
|
config,
|
|
...
|
|
}: let
|
|
# Telescope
|
|
# { key = "<leader>ff";
|
|
# action = config.lib.nixvim.mkRaw "require('telescope.builtin').find_files";
|
|
# } becomes:
|
|
# { key = ldr "ff";
|
|
# action = mfn "telescope.builtin" "find_files";
|
|
# } becomes:
|
|
# (tscope "ff" "find_files")
|
|
lua = config.lib.nixvim.mkRaw;
|
|
ldr = k: "<leader>${k}";
|
|
key = k: fn: {
|
|
key = "${k}";
|
|
action = lua "${fn}";
|
|
};
|
|
lkey = k: fn: {
|
|
key = ldr "${k}";
|
|
action = lua "${fn}";
|
|
};
|
|
luaf = fn: "function() ${fn} end";
|
|
luafr = m: fn: "function() require('${m}').${fn} end";
|
|
|
|
mkey = module: k: fn: (lkey "${k}" "require('${module}').${fn}");
|
|
tscope = k: fn: mkey "telescope.builtin" "${k}" "${fn}";
|
|
gs = k: fn: mkey "gitsigns" "${k}" "${fn}";
|
|
in {
|
|
programs.nixvim.keymaps = [
|
|
(tscope "ff" "find_files")
|
|
(tscope "fg" "live_grep")
|
|
(tscope "fb" "buffers")
|
|
(tscope "fh" "help_tags")
|
|
|
|
(gs "hs" "stage_hunk")
|
|
(gs "rs" "reset_hunk")
|
|
(gs "hS" "stage_buffer")
|
|
(gs "hu" "undo_stage_hunk")
|
|
(gs "hR" "reset_buffer")
|
|
(gs "hp" "preview_hunk")
|
|
(gs "tb" "toggle_current_line_blame")
|
|
(gs "hd" "diffthis")
|
|
(gs "td" "toggle_deleted")
|
|
|
|
(key "<F5>" (luafr "nvim-tree.api" "tree.toggle()"))
|
|
(lkey "d" "vim.cmd.bdelete")
|
|
];
|
|
}
|