2023-02-28 07:13:56 +00:00
|
|
|
{
|
2024-10-25 23:51:58 +00:00
|
|
|
options,
|
2023-02-28 07:13:56 +00:00
|
|
|
config,
|
|
|
|
lib,
|
|
|
|
...
|
2023-11-07 00:50:27 +00:00
|
|
|
}: let
|
2024-09-30 19:58:21 +00:00
|
|
|
inherit (lib.modules) mkIf;
|
|
|
|
inherit (lib.nvim.binds) addDescriptionsToMappings;
|
|
|
|
inherit (lib.strings) optionalString;
|
|
|
|
inherit (lib.lists) optionals;
|
|
|
|
inherit (lib.nvim.binds) pushDownDefault mkSetLznBinding;
|
2023-11-07 00:50:27 +00:00
|
|
|
|
2023-02-28 07:13:56 +00:00
|
|
|
cfg = config.vim.telescope;
|
2024-10-25 23:51:58 +00:00
|
|
|
mappingDefinitions = options.vim.telescope.mappings;
|
2023-04-22 13:48:21 +00:00
|
|
|
|
|
|
|
mappings = addDescriptionsToMappings cfg.mappings mappingDefinitions;
|
2023-02-28 07:13:56 +00:00
|
|
|
in {
|
2024-07-08 21:57:58 +00:00
|
|
|
config = mkIf cfg.enable {
|
2024-09-08 15:44:42 +00:00
|
|
|
vim = {
|
2024-09-30 19:58:21 +00:00
|
|
|
startPlugins = ["plenary-nvim"];
|
2023-04-22 13:48:21 +00:00
|
|
|
|
2024-10-17 15:17:18 +00:00
|
|
|
lazy.plugins.telescope = {
|
|
|
|
package = "telescope";
|
|
|
|
setupModule = "telescope";
|
|
|
|
inherit (cfg) setupOpts;
|
|
|
|
after = ''
|
|
|
|
local telescope = require("telescope")
|
|
|
|
${optionalString config.vim.ui.noice.enable "telescope.load_extension('noice')"}
|
|
|
|
${optionalString config.vim.notify.nvim-notify.enable "telescope.load_extension('notify')"}
|
|
|
|
${optionalString config.vim.projects.project-nvim.enable "telescope.load_extension('projects')"}
|
|
|
|
'';
|
2023-02-28 07:13:56 +00:00
|
|
|
|
2024-10-17 15:17:18 +00:00
|
|
|
cmd = ["Telescope"];
|
2023-02-28 07:13:56 +00:00
|
|
|
|
2024-10-17 15:17:18 +00:00
|
|
|
keys =
|
|
|
|
[
|
|
|
|
(mkSetLznBinding mappings.findFiles "<cmd> Telescope find_files<CR>")
|
|
|
|
(mkSetLznBinding mappings.liveGrep "<cmd> Telescope live_grep<CR>")
|
|
|
|
(mkSetLznBinding mappings.buffers "<cmd> Telescope buffers<CR>")
|
|
|
|
(mkSetLznBinding mappings.helpTags "<cmd> Telescope help_tags<CR>")
|
|
|
|
(mkSetLznBinding mappings.open "<cmd> Telescope<CR>")
|
2023-04-22 13:48:21 +00:00
|
|
|
|
2024-10-17 15:17:18 +00:00
|
|
|
(mkSetLznBinding mappings.gitCommits "<cmd> Telescope git_commits<CR>")
|
|
|
|
(mkSetLznBinding mappings.gitBufferCommits "<cmd> Telescope git_bcommits<CR>")
|
|
|
|
(mkSetLznBinding mappings.gitBranches "<cmd> Telescope git_branches<CR>")
|
|
|
|
(mkSetLznBinding mappings.gitStatus "<cmd> Telescope git_status<CR>")
|
|
|
|
(mkSetLznBinding mappings.gitStash "<cmd> Telescope git_stash<CR>")
|
|
|
|
]
|
|
|
|
++ (optionals config.vim.lsp.enable [
|
|
|
|
(mkSetLznBinding mappings.lspDocumentSymbols "<cmd> Telescope lsp_document_symbols<CR>")
|
|
|
|
(mkSetLznBinding mappings.lspWorkspaceSymbols "<cmd> Telescope lsp_workspace_symbols<CR>")
|
2023-06-05 20:10:25 +00:00
|
|
|
|
2024-10-17 15:17:18 +00:00
|
|
|
(mkSetLznBinding mappings.lspReferences "<cmd> Telescope lsp_references<CR>")
|
|
|
|
(mkSetLznBinding mappings.lspImplementations "<cmd> Telescope lsp_implementations<CR>")
|
|
|
|
(mkSetLznBinding mappings.lspDefinitions "<cmd> Telescope lsp_definitions<CR>")
|
|
|
|
(mkSetLznBinding mappings.lspTypeDefinitions "<cmd> Telescope lsp_type_definitions<CR>")
|
|
|
|
(mkSetLznBinding mappings.diagnostics "<cmd> Telescope diagnostics<CR>")
|
|
|
|
])
|
|
|
|
++ (
|
|
|
|
optionals config.vim.treesitter.enable [
|
|
|
|
(mkSetLznBinding mappings.treesitter "<cmd> Telescope treesitter<CR>")
|
|
|
|
]
|
|
|
|
)
|
|
|
|
++ (
|
|
|
|
optionals config.vim.projects.project-nvim.enable [
|
|
|
|
(mkSetLznBinding mappings.findProjects "<cmd Telescope projects<CR>")
|
|
|
|
]
|
|
|
|
);
|
|
|
|
};
|
2023-02-28 07:13:56 +00:00
|
|
|
|
2024-09-08 15:44:42 +00:00
|
|
|
binds.whichKey.register = pushDownDefault {
|
|
|
|
"<leader>f" = "+Telescope";
|
|
|
|
"<leader>fl" = "Telescope LSP";
|
|
|
|
"<leader>fm" = "Cellular Automaton";
|
|
|
|
"<leader>fv" = "Telescope Git";
|
|
|
|
"<leader>fvc" = "Commits";
|
|
|
|
};
|
|
|
|
};
|
2023-02-28 07:13:56 +00:00
|
|
|
};
|
|
|
|
}
|