2023-02-28 08:13:56 +01:00
|
|
|
{
|
2024-11-04 16:50:50 +01:00
|
|
|
options,
|
2023-02-28 08:13:56 +01:00
|
|
|
config,
|
|
|
|
lib,
|
|
|
|
...
|
2023-11-07 01:50:27 +01:00
|
|
|
}: let
|
2024-11-04 16:50:50 +01:00
|
|
|
inherit (lib.modules) mkIf;
|
|
|
|
inherit (lib.strings) optionalString;
|
|
|
|
inherit (lib.lists) optionals;
|
2024-11-17 19:31:55 +01:00
|
|
|
inherit (lib.nvim.binds) pushDownDefault mkKeymap;
|
2023-11-07 01:50:27 +01:00
|
|
|
|
2023-02-28 08:13:56 +01:00
|
|
|
cfg = config.vim.telescope;
|
2023-04-22 15:48:21 +02:00
|
|
|
|
2024-11-17 19:31:55 +01:00
|
|
|
keys = cfg.mappings;
|
|
|
|
inherit (options.vim.telescope) mappings;
|
2023-02-28 08:13:56 +01:00
|
|
|
in {
|
2024-07-08 23:57:58 +02:00
|
|
|
config = mkIf cfg.enable {
|
2024-09-08 17:44:42 +02:00
|
|
|
vim = {
|
2024-11-04 16:50:50 +01:00
|
|
|
startPlugins = ["plenary-nvim"];
|
2023-02-28 08:13:56 +01:00
|
|
|
|
2024-11-04 16:50:50 +01: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-04-22 15:48:21 +02:00
|
|
|
|
2024-11-04 16:50:50 +01:00
|
|
|
cmd = ["Telescope"];
|
2023-02-28 08:13:56 +01:00
|
|
|
|
2024-11-04 16:50:50 +01:00
|
|
|
keys =
|
|
|
|
[
|
2024-11-17 19:31:55 +01:00
|
|
|
(mkKeymap "n" keys.findFiles "<cmd>Telescope find_files<CR>" {desc = mappings.findFiles.description;})
|
|
|
|
(mkKeymap "n" keys.liveGrep "<cmd>Telescope live_grep<CR>" {desc = mappings.liveGrep.description;})
|
|
|
|
(mkKeymap "n" keys.buffers "<cmd>Telescope buffers<CR>" {desc = mappings.buffers.description;})
|
|
|
|
(mkKeymap "n" keys.helpTags "<cmd>Telescope help_tags<CR>" {desc = mappings.helpTags.description;})
|
|
|
|
(mkKeymap "n" keys.open "<cmd>Telescope<CR>" {desc = mappings.open.description;})
|
|
|
|
(mkKeymap "n" keys.resume "<cmd>Telescope resume<CR>" {desc = mappings.resume.description;})
|
2023-02-28 08:13:56 +01:00
|
|
|
|
2024-11-17 19:31:55 +01:00
|
|
|
(mkKeymap "n" keys.gitCommits "<cmd>Telescope git_commits<CR>" {desc = mappings.gitCommits.description;})
|
|
|
|
(mkKeymap "n" keys.gitBufferCommits "<cmd>Telescope git_bcommits<CR>" {desc = mappings.gitBufferCommits.description;})
|
|
|
|
(mkKeymap "n" keys.gitBranches "<cmd>Telescope git_branches<CR>" {desc = mappings.gitBranches.description;})
|
|
|
|
(mkKeymap "n" keys.gitStatus "<cmd>Telescope git_status<CR>" {desc = mappings.gitStatus.description;})
|
|
|
|
(mkKeymap "n" keys.gitStash "<cmd>Telescope git_stash<CR>" {desc = mappings.gitStash.description;})
|
2024-11-04 16:50:50 +01:00
|
|
|
]
|
|
|
|
++ (optionals config.vim.lsp.enable [
|
2024-11-17 19:31:55 +01:00
|
|
|
(mkKeymap "n" keys.lspDocumentSymbols "<cmd>Telescope lsp_document_symbols<CR>" {desc = mappings.lspDocumentSymbols.description;})
|
|
|
|
(mkKeymap "n" keys.lspWorkspaceSymbols "<cmd>Telescope lsp_workspace_symbols<CR>" {desc = mappings.lspWorkspaceSymbols.description;})
|
2023-04-22 15:48:21 +02:00
|
|
|
|
2024-11-17 19:31:55 +01:00
|
|
|
(mkKeymap "n" keys.lspReferences "<cmd>Telescope lsp_references<CR>" {desc = mappings.lspReferences.description;})
|
|
|
|
(mkKeymap "n" keys.lspImplementations "<cmd>Telescope lsp_implementations<CR>" {desc = mappings.lspImplementations.description;})
|
|
|
|
(mkKeymap "n" keys.lspDefinitions "<cmd>Telescope lsp_definitions<CR>" {desc = mappings.lspDefinitions.description;})
|
|
|
|
(mkKeymap "n" keys.lspTypeDefinitions "<cmd>Telescope lsp_type_definitions<CR>" {desc = mappings.lspTypeDefinitions.description;})
|
|
|
|
(mkKeymap "n" keys.diagnostics "<cmd>Telescope diagnostics<CR>" {desc = mappings.diagnostics.description;})
|
2024-11-04 16:50:50 +01:00
|
|
|
])
|
2024-11-17 19:31:55 +01:00
|
|
|
++ optionals config.vim.treesitter.enable [
|
|
|
|
(mkKeymap "n" keys.treesitter "<cmd>Telescope treesitter<CR>" {desc = mappings.treesitter.description;})
|
|
|
|
]
|
|
|
|
++ optionals config.vim.projects.project-nvim.enable [
|
|
|
|
(mkKeymap "n" keys.findProjects "<cmd>Telescope projects<CR>" {desc = mappings.findProjects.description;})
|
|
|
|
];
|
2024-11-04 16:50:50 +01:00
|
|
|
};
|
2023-02-28 08:13:56 +01:00
|
|
|
|
2024-09-08 17:44:42 +02: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 08:13:56 +01:00
|
|
|
};
|
|
|
|
}
|