local M = { 'nvim-telescope/telescope.nvim' } M.dependencies = { 'nvim-telescope/telescope-fzf-native.nvim', build = 'cmake -S. -Bbuild -DCMAKE_BUILD_TYPE=Release ' .. '&& cmake --build build --config Release ' .. '&& cmake --install build --prefix build', } M.cmd = 'Telescope' local pick = require('fschauen.telescope').pickers M.keys = { { 'fa', pick.autocommands ' Autocommands' , desc = ' Telescope [a]utocommands' }, { 'fb', pick.buffers ' Buffers' , desc = ' Telescope [b]uffers' }, { 'fc', pick.colorscheme ' Colorschemes' , desc = ' Telescope [c]olorschemes' }, { 'fdd', pick.diagnostics '󰀪 Document Diagnostics' , desc = ' Telescope [d]iagnostics [d]ocument' }, { 'fdw', pick.diagnostics '󰀪 Workspace Diagnostics', desc = ' Telescope [d]iagnostics [w]orkspace' }, --'fe' { 'ff', pick.find_files ' Files' , desc = ' Telescope [f]ind files' }, { 'fF', pick.all_files ' ALL files' , desc = ' Telescope all [F]iles' }, { 'fgr', pick.live_grep ' Live grep' , desc = ' Telescope Live [gr]ep' }, { 'fgf', pick.git_files ' Git files' , desc = ' Telescope [g]it [f]iles' }, { 'fgc', pick.git_commits ' Commits' , desc = ' Telescope [g]it [c]ommits' }, { 'fh', pick.here ' Current buffer' , desc = ' Telescope [b]uffer [h]ere' }, { 'fH', pick.highlights '󰌶 Highlights' , desc = ' Telescope [H]ighlights' }, --'fi' { 'fj', pick.jumplist ' Jumplist' , desc = ' Telescope [j]umplist' }, { 'fk', pick.keymaps ' Keymaps' , desc = ' Telescope [k]eymaps' }, { 'fK', pick.help_tags ' Help tags' , desc = ' Telescope [K] help/documentation' }, { 'fl', pick.loclist ' Location list' , desc = ' Telescope [l]ocation List' }, { 'fm', pick.man_pages ' Man pages' , desc = ' Telescope [m]an pages' }, --'fn' { 'fo', pick.vim_options ' Vim options' , desc = ' Telescope vim [o]ptions' }, --'fp' { 'fq', pick.quickfix ' Quickfix' , desc = ' Telescope [q]uickfix' }, { 'fr', pick.lsp_references ' References' , desc = ' Telescope [r]eferences' }, { 'fR', pick.registers '󱓥 Registers' , desc = ' Telescope [R]registers' }, { 'fs', pick.lsp_document_symbols '󰫧 Document Symbols ' , desc = ' Telescope lsp document [s]ymbols' }, { 'fS', pick.lsp_workspace_symbols '󱄑 Workspace Symbols ' , desc = ' Telescope lsp workspace [S]ymbols' }, --'ft' used in todo_comments { 'fT', pick.treesitter ' Treesitter symbols' , desc = ' Telescope [T]reesitter Symbols' }, --'fu' --'fv' { 'fw', pick.selection ' Grep' , desc = ' Telescope [w]word under cursor' }, { 'fw', pick.selection ' Grep', mode = 'v' , desc = ' Telescope [w]ord(s) selected' }, --'fx' --'fy' { 'fz', pick.spell_suggest '󰓆 Spelling suggestions' , desc = ' Telescope [z] spell suggestions' }, { 'f.', pick.dotfiles ' Dotfiles' , desc = ' Telescope [.]dotfiles' }, { 'f:', pick.command_history ' Command history' , desc = ' Telescope [:]command history' }, { 'f?', pick.commands ' Commands' , desc = ' Telescope commands [?]' }, { 'f/', pick.search_history ' Search history' , desc = ' Telescope [/]search history' }, { 'f', pick.resume '󰐎 Resume' , desc = ' Telescope Resume ' }, } M.opts = function() local actions = require('telescope.actions') local layout = require('telescope.actions.layout') local trouble = vim.F.npcall(require, 'trouble.providers.telescope') or {} local mappings = { [''] = actions.cycle_history_next, [''] = actions.cycle_history_prev, [''] = actions.preview_scrolling_down, [''] = actions.preview_scrolling_up, [''] = layout.cycle_layout_next, [''] = layout.toggle_mirror, [''] = actions.close, [''] = actions.smart_send_to_qflist + actions.open_qflist, [''] = actions.smart_send_to_loclist + actions.open_loclist, [''] = trouble.smart_open_with_trouble, } return { defaults = { mappings = { i = mappings, n = mappings, }, prompt_prefix = '  ', -- Alternatives:  ❯ selection_caret = ' ', -- Alternatives:  ➔  multi_icon = '󰄬 ', -- Alternatives: 󰄬   scroll_strategy = 'limit', -- Don't wrap around in results. dynamic_preview_title = true, layout_strategy = 'flex', layout_config = { width = 0.9, height = 0.9, flex = { flip_columns = 130 }, horizontal = { preview_width = 0.5, preview_cutoff = 130 }, vertical = { preview_height = 0.5 }, }, cycle_layout_list = { 'horizontal', 'vertical' }, }, pickers = { buffers = { mappings = { n = { x = actions.delete_buffer, }, }, }, colorscheme = { theme = 'dropdown', }, spell_suggest = { theme = 'cursor', }, }, extensions = { file_browser = { theme = 'ivy' }, }, } end M.config = function(_, opts) require('telescope').setup(opts) require('telescope').load_extension 'fzf' vim.api.nvim_create_autocmd('User', { desc = 'Enable line number in Telescope previewers.', group = vim.api.nvim_create_augroup('fschauen.telescope', { clear = true } ), pattern = 'TelescopePreviewerLoaded', command = 'setlocal number' }) end return M