2024-01-30 10:04:56 +00:00
|
|
|
{ config, lib, ... }:
|
|
|
|
|
|
|
|
let
|
|
|
|
nixvimCfg = config.nixvimConfigs.fiesta;
|
|
|
|
cfg = nixvimCfg.setups.fuzzy-finder;
|
|
|
|
in
|
|
|
|
{
|
|
|
|
options.nixvimConfigs.fiesta.setups.fuzzy-finder.enable =
|
|
|
|
lib.mkEnableOption "fuzzy finder setup";
|
|
|
|
|
|
|
|
config = lib.mkIf cfg.enable {
|
|
|
|
plugins.telescope.enable = true;
|
|
|
|
|
2024-02-03 13:28:07 +00:00
|
|
|
plugins.project-nvim.enable = lib.mkDefault true;
|
|
|
|
plugins.telescope.extensions.project-nvim.enable = config.plugins.project-nvim.enable;
|
|
|
|
|
2024-01-30 10:04:56 +00:00
|
|
|
# Configure all of the keymaps.
|
|
|
|
keymaps =
|
|
|
|
let
|
|
|
|
bindingPrefix = "<leader>f";
|
2024-02-02 09:28:07 +00:00
|
|
|
mkTelescopeKeymap = binding: settings:
|
|
|
|
lib.mergeAttrs
|
|
|
|
{
|
2024-01-30 10:04:56 +00:00
|
|
|
mode = "n";
|
|
|
|
key = "${bindingPrefix}${binding}";
|
2024-02-02 09:28:07 +00:00
|
|
|
}
|
|
|
|
settings;
|
2024-01-30 10:04:56 +00:00
|
|
|
in
|
2024-02-02 09:28:07 +00:00
|
|
|
lib.mapAttrsToList mkTelescopeKeymap ({
|
2024-01-30 10:04:56 +00:00
|
|
|
"A" = {
|
|
|
|
options.desc = "Resume from last use";
|
|
|
|
action = "require('telescope.builtin').resume";
|
|
|
|
lua = true;
|
|
|
|
};
|
|
|
|
"b" = {
|
|
|
|
options.desc = "List buffers";
|
|
|
|
action = "require('telescope.builtin').buffers";
|
|
|
|
lua = true;
|
|
|
|
};
|
|
|
|
"f" = {
|
|
|
|
options.desc = "Find files";
|
|
|
|
action = ''
|
|
|
|
function()
|
|
|
|
require('telescope.builtin').find_files { hidden = true }
|
|
|
|
end
|
|
|
|
'';
|
|
|
|
lua = true;
|
|
|
|
};
|
|
|
|
"F" = {
|
|
|
|
options.desc = "Find files in current directory";
|
|
|
|
action = ''
|
|
|
|
function()
|
|
|
|
require('telescope.builtin').find_files {
|
|
|
|
cwd = require('telescope.utils').buffer_dir(),
|
|
|
|
hidden = true,
|
|
|
|
}
|
|
|
|
end
|
|
|
|
'';
|
|
|
|
lua = true;
|
|
|
|
};
|
|
|
|
"g" = {
|
|
|
|
options.desc = "Find files tracked by Git";
|
|
|
|
action = "require('telescope.builtin').git_files";
|
|
|
|
lua = true;
|
|
|
|
};
|
|
|
|
"G" = {
|
|
|
|
options.desc = "Live grep for the whole project";
|
|
|
|
action = "require('telescope.builtin').live_grep";
|
|
|
|
lua = true;
|
|
|
|
};
|
|
|
|
"h" = {
|
|
|
|
options.desc = "Find section from help tags";
|
|
|
|
action = "require('telescope.builtin').help_tags";
|
|
|
|
lua = true;
|
|
|
|
};
|
|
|
|
"m" = {
|
|
|
|
options.desc = "Find manpage entries";
|
|
|
|
action = "require('telescope.builtin').man_pages";
|
|
|
|
lua = true;
|
|
|
|
};
|
|
|
|
}
|
|
|
|
// lib.optionalAttrs nixvimCfg.setups.treesitter.enable {
|
|
|
|
"t" = {
|
|
|
|
options.desc = "List symbols from treesitter queries";
|
|
|
|
action = "require('telescope.builtin').treesitter";
|
|
|
|
lua = true;
|
|
|
|
};
|
|
|
|
});
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|