modules: add telescope-nvim

This commit is contained in:
Dmitriy Pleshevskiy 2024-04-21 12:20:06 +03:00
parent 439437402d
commit eeca046ef2
Signed by: pleshevskiy
GPG Key ID: 17041163DA10A9A2
2 changed files with 35 additions and 0 deletions

View File

@ -255,6 +255,7 @@
gitsigns-nvim = { };
neoformat = { };
hop-nvim = { };
telescope-nvim = { };
};
plugins = with prev.nix2lua.lib; {

View File

@ -0,0 +1,34 @@
{ nix2lua, vim, ... }:
with nix2lua.lib;
let
defaultKeymaps = [
{ mode = "n"; bind = "<leader>ff"; command = "<Cmd>Telescope find_files hidden=true<CR>"; }
{ mode = "n"; bind = "<leader>fb"; command = "<Cmd>Telescope buffers<CR>"; }
{ mode = "n"; bind = "<leader>fh"; command = "<Cmd>Telescope help_tags<CR>"; }
{ mode = "n"; bind = "<leader>fg"; command = lambda0 (call0 "telescope.extensions.live_grep_args.live_grep_args"); }
];
in
{ configs ? { }
, keymaps ? defaultKeymaps
, extraKeymaps ? [ ]
# TODO: add possibility to configure extensions
}:
{
# telescope requirements
plenary-nvim = true;
# telescope extension
telescope-live-grep-args-nvim = true;
telescope-nvim = [
(local (set "telescope" (require "telescope")))
(pipe1 (var "telescope") (call "setup" configs))
(pipe1 (var "telescope") (call "load_extension" "live_grep_args"))
] ++ map vim.keymap.set (keymaps ++ extraKeymaps);
}