Refactor Telescope keymaps to dedicated telescope plugin file

- Remove Telescope keymaps from keymaps.nix
- Add Telescope keymaps to telescope.nix
- Include new keymap for grep string under cursor and recently opened files
This commit is contained in:
Sam 2024-11-12 17:03:53 +00:00
parent d058b2cf72
commit 2d78446105
2 changed files with 44 additions and 29 deletions

View File

@ -50,35 +50,6 @@ programs.nixvim.keymaps = [
options = {noremap = true;}; options = {noremap = true;};
} }
# Telescope Plugin
{
# find files
mode = ["n"];
key = "<Leader>ff";
action = "<cmd>Telescope find_files<CR>";
options = {noremap = true;};
}
{
# live grep
mode = ["n"];
key = "<Leader>fg";
action = "<cmd>Telescope live_grep<CR>";
options = {noremap = true;};
}
{
# buffers
mode = ["n"];
key = "<Leader>fb";
action = "<cmd>Telescope buffers<CR>";
options = {noremap = true;};
}
{
# help tags
mode = ["n"];
key = "<Leader>fh";
action = "<cmd>Telescope help_tags<CR>";
options = {noremap = true;};
}
# paste over selected text without yanking it # paste over selected text without yanking it
{ {
mode = ["v"]; mode = ["v"];

View File

@ -3,4 +3,48 @@
enable = true; enable = true;
extensions.fzy-native.enable = true; extensions.fzy-native.enable = true;
}; };
keymaps = [
{
# find files
mode = ["n"];
key = "<Leader>ff";
action = "<cmd>Telescope find_files<CR>";
options = {noremap = true;};
}
{
# live grep
mode = ["n"];
key = "<Leader>fg";
action = "<cmd>Telescope live_grep<CR>";
options = {noremap = true;};
}
{
# grep string under cursor
mode = ["n"];
key = "<Leader>fs";
action = "<cmd>Telescope string_grep<CR>";
options = {noremap = true;};
}
{
# buffers
mode = ["n"];
key = "<Leader>fb";
action = "<cmd>Telescope buffers<CR>";
options = {noremap = true;};
}
{
# help tags
mode = ["n"];
key = "<Leader>fh";
action = "<cmd>Telescope help_tags<CR>";
options = {noremap = true;};
}
{
# show recently opened files
mode = ["n"];
key = "<Leader>fo";
action = "<cmd>Telescope oldfiles<CR>";
options = {noremap = true;};
}
];
} }