telescope.lua (2496B)
1 pcall(require('telescope').load_extension, 'fzf') 2 require('telescope').setup { 3 defaults = { 4 mappings = { 5 i = { 6 ['<C-u>'] = false, 7 ['<C-d>'] = false, 8 }, 9 }, 10 }, 11 } 12 -- Disable folding in Telescope's result window. 13 vim.api.nvim_create_autocmd("FileType", 14 { pattern = "TelescopeResults", command = [[setlocal nofoldenable foldlevelstart=99]] }) 15 16 vim.keymap.set('n', '<leader>sp', require('telescope.builtin').oldfiles, { desc = '[S]earch [p]reviously opened files' }) 17 vim.keymap.set('n', '<leader>b', require('telescope.builtin').buffers, { desc = 'Find existing buffers' }) 18 vim.keymap.set('n', '<leader>sf', require('telescope.builtin').find_files, { desc = '[S]earch [F]iles' }) 19 vim.keymap.set('n', '<leader>cv', 20 function() require('telescope.builtin').find_files({ cwd = vim.env.DOTFILES .. '/nvim' }) end, 21 { desc = 'Neovim configs' }) 22 vim.keymap.set('n', '<leader>sh', require('telescope.builtin').help_tags, { desc = '[S]earch [H]elp' }) 23 vim.keymap.set('n', '<leader>sw', require('telescope.builtin').grep_string, { desc = '[S]earch current [W]ord' }) 24 vim.keymap.set('n', '<leader>sg', require('telescope.builtin').live_grep, { desc = '[S]earch by [G]rep' }) 25 vim.keymap.set('n', '<leader>sd', require('telescope.builtin').diagnostics, { desc = '[S]earch [D]iagnostics' }) 26 vim.keymap.set('n', '<leader>sr', require('telescope.builtin').lsp_references, { desc = '[S]earch [R]eferences' }) 27 vim.keymap.set('n', '<leader>s<', require('telescope.builtin').lsp_incoming_calls, { desc = '[S]earch [I]ncoming calls' }) 28 vim.keymap.set('n', '<leader>s>', require('telescope.builtin').lsp_outgoing_calls, { desc = '[S]earch [O]utgoing calls' }) 29 vim.keymap.set('n', '<leader>sI', require('telescope.builtin').lsp_implementations, 30 { desc = '[S]earch [i]mplementations' }) 31 vim.keymap.set('n', '<leader>ss', function() 32 local server_ready = not not vim.lsp.buf_notify(0, '$/progress', {}) 33 if server_ready then 34 require('telescope.builtin').lsp_dynamic_workspace_symbols() 35 else 36 require('telescope.builtin').treesitter() 37 end 38 end, { desc = '[S]earch [S]ymbols' }) 39 vim.keymap.set('n', '<leader>sj', require('telescope.builtin').jumplist, { desc = '[S]earch [J]umplist' }) 40 vim.keymap.set('n', '<leader>sb', function() 41 local server_ready = not not vim.lsp.buf_notify(0, '$/progress', {}) 42 if server_ready then 43 require('telescope.builtin').lsp_document_symbols() 44 else 45 require('telescope.builtin').tags() 46 end 47 end, { desc = 'Telescope [T]ags' })