{ pkgs, config, lib, ... }: with lib; with builtins; let cfg = config.vim.telescope; self = import ./telescope.nix {inherit lib;}; mappingDefinitions = self.options.vim.telescope.mappings; mappings = addDescriptionsToMappings cfg.mappings mappingDefinitions; in { config = mkIf (cfg.enable) { vim.startPlugins = [ "telescope" ]; vim.maps.normal = mkMerge [ (mkSetBinding mappings.findFiles " Telescope find_files") (mkSetBinding mappings.liveGrep " Telescope live_grep") (mkSetBinding mappings.buffers " Telescope buffers") (mkSetBinding mappings.helpTags " Telescope help_tags") (mkSetBinding mappings.open " Telescope") (mkSetBinding mappings.gitCommits " Telescope git_commits") (mkSetBinding mappings.gitBufferCommits " Telescope git_bcommits") (mkSetBinding mappings.gitBranches " Telescope git_branches") (mkSetBinding mappings.gitStatus " Telescope git_status") (mkSetBinding mappings.gitStash " Telescope git_stash") (mkIf config.vim.lsp.enable (mkMerge [ (mkSetBinding mappings.lspDocumentSymbols " Telescope lsp_document_symbols") (mkSetBinding mappings.lspWorkspaceSymbols " Telescope lsp_workspace_symbols") (mkSetBinding mappings.lspReferences " Telescope lsp_references") (mkSetBinding mappings.lspImplementations " Telescope lsp_implementations") (mkSetBinding mappings.lspDefinitions " Telescope lsp_definitions") (mkSetBinding mappings.lspTypeDefinitions " Telescope lsp_type_definitions") (mkSetBinding mappings.diagnostics " Telescope diagnostics") ])) ( mkIf config.vim.treesitter.enable (mkSetBinding mappings.treesitter " Telescope treesitter") ) ]; vim.luaConfigRC.telescope = nvim.dag.entryAnywhere '' local telescope = require('telescope') telescope.setup { defaults = { vimgrep_arguments = { "${pkgs.ripgrep}/bin/rg", "--color=never", "--no-heading", "--with-filename", "--line-number", "--column", "--smart-case", "--hidden", "--no-ignore", }, pickers = { find_command = { "${pkgs.fd}/bin/fd", }, }, }, prompt_prefix = "  ", selection_caret = " ", entry_prefix = " ", initial_mode = "insert", selection_strategy = "reset", sorting_strategy = "ascending", layout_strategy = "horizontal", layout_config = { horizontal = { prompt_position = "top", preview_width = 0.55, results_width = 0.8, }, vertical = { mirror = false, }, width = 0.8, height = 0.8, preview_cutoff = 120, }, file_ignore_patterns = { "node_modules", ".git/", "dist/", "build/", "target/", "result/" }, -- TODO: make this configurable color_devicons = true, path_display = { "absolute" }, set_env = { ["COLORTERM"] = "truecolor" }, winblend = 0, border = {}, } ${ if config.vim.ui.noice.enable then "telescope.load_extension('noice')" else "" } ${ if config.vim.notify.nvim-notify.enable then "telescope.load_extension('notify')" else "" } ${ if config.vim.projects.project-nvim.enable then "telescope.load_extension('projects')" else "" } ''; }; }