Telescope
Setup
-- lua/plugins/telescope.lua
return {
'nvim-telescope/telescope.nvim',
branch = '0.1.x',
dependencies = {
'nvim-lua/plenary.nvim',
-- Optional but recommended: native FZF sorter for performance
{
'nvim-telescope/telescope-fzf-native.nvim',
build = 'make',
},
'nvim-tree/nvim-web-devicons',
},
cmd = 'Telescope',
keys = {
{ '<leader>ff', '<cmd>Telescope find_files<CR>', desc = 'Find files' },
{ '<leader>fg', '<cmd>Telescope live_grep<CR>', desc = 'Live grep' },
{ '<leader>fb', '<cmd>Telescope buffers<CR>', desc = 'Buffers' },
{ '<leader>fh', '<cmd>Telescope help_tags<CR>', desc = 'Help tags' },
{ '<leader>fo', '<cmd>Telescope oldfiles<CR>', desc = 'Recent files' },
{ '<leader>fw', '<cmd>Telescope grep_string<CR>', desc = 'Grep word under cursor' },
{ '<leader>fd', '<cmd>Telescope diagnostics<CR>', desc = 'Diagnostics' },
{ '<leader>fr', '<cmd>Telescope resume<CR>', desc = 'Resume last search' },
{ '<leader>/', '<cmd>Telescope current_buffer_fuzzy_find<CR>', desc = 'Fuzzy find in buffer' },
},
config = function()
local telescope = require('telescope')
local actions = require('telescope.actions')
telescope.setup({
defaults = {
mappings = {
i = {
['<C-j>'] = actions.move_selection_next,
['<C-k>'] = actions.move_selection_previous,
['<C-q>'] = actions.send_to_qflist + actions.open_qflist,
['<Esc>'] = actions.close,
},
},
file_ignore_patterns = {
'node_modules',
'.git/',
'dist/',
'build/',
},
layout_config = {
horizontal = { preview_width = 0.55 },
vertical = { mirror = false },
width = 0.87,
height = 0.80,
},
},
pickers = {
find_files = {
hidden = true, -- Show hidden files
},
buffers = {
sort_mru = true, -- Most recently used first
},
},
})
-- Load fzf-native extension for better performance
pcall(telescope.load_extension, 'fzf')
end,
}Essential Pickers
File Finding
Picker
Description
Shortcut
Text Searching
Picker
Description
Shortcut
Buffer & Navigation
Picker
Description
Shortcut
LSP Pickers
Git Pickers
Telescope Keybindings (Inside the Picker)
Insert Mode (while typing)
Key
Action
Normal Mode (press Esc first)
Key
Action
Extensions
Extension
Description
Migrating from FZF.vim
FZF.vim
Telescope
Summary
Exercises
Last updated
Was this helpful?