{ options, config, lib, ... }: let inherit (lib.modules) mkIf; inherit (lib.nvim.binds) addDescriptionsToMappings; inherit (lib.strings) optionalString; inherit (lib.lists) optionals; inherit (lib.nvim.binds) pushDownDefault mkSetLznBinding; cfg = config.vim.telescope; mappingDefinitions = options.vim.telescope.mappings; mappings = addDescriptionsToMappings cfg.mappings mappingDefinitions; in { config = mkIf cfg.enable { vim = { startPlugins = ["plenary-nvim"]; 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')"} ''; cmd = ["Telescope"]; keys = [ (mkSetLznBinding "n" mappings.findFiles "Telescope find_files") (mkSetLznBinding "n" mappings.liveGrep "Telescope live_grep") (mkSetLznBinding "n" mappings.buffers "Telescope buffers") (mkSetLznBinding "n" mappings.helpTags "Telescope help_tags") (mkSetLznBinding "n" mappings.open "Telescope") (mkSetLznBinding "n" mappings.resume "Telescope resume") (mkSetLznBinding "n" mappings.gitCommits "Telescope git_commits") (mkSetLznBinding "n" mappings.gitBufferCommits "Telescope git_bcommits") (mkSetLznBinding "n" mappings.gitBranches "Telescope git_branches") (mkSetLznBinding "n" mappings.gitStatus "Telescope git_status") (mkSetLznBinding "n" mappings.gitStash "Telescope git_stash") ] ++ (optionals config.vim.lsp.enable [ (mkSetLznBinding "n" mappings.lspDocumentSymbols "Telescope lsp_document_symbols") (mkSetLznBinding "n" mappings.lspWorkspaceSymbols "Telescope lsp_workspace_symbols") (mkSetLznBinding "n" mappings.lspReferences "Telescope lsp_references") (mkSetLznBinding "n" mappings.lspImplementations "Telescope lsp_implementations") (mkSetLznBinding "n" mappings.lspDefinitions "Telescope lsp_definitions") (mkSetLznBinding "n" mappings.lspTypeDefinitions "Telescope lsp_type_definitions") (mkSetLznBinding "n" mappings.diagnostics "Telescope diagnostics") ]) ++ ( optionals config.vim.treesitter.enable [ (mkSetLznBinding "n" mappings.treesitter "Telescope treesitter") ] ) ++ ( optionals config.vim.projects.project-nvim.enable [ (mkSetLznBinding "n" mappings.findProjects "Telescope projects") ] ); }; binds.whichKey.register = pushDownDefault { "f" = "+Telescope"; "fl" = "Telescope LSP"; "fm" = "Cellular Automaton"; "fv" = "Telescope Git"; "fvc" = "Commits"; }; }; }; }