110 lines
3.6 KiB
Lua
110 lines
3.6 KiB
Lua
-- Telescope fuzzy finder
|
|
return {
|
|
{
|
|
'nvim-telescope/telescope.nvim',
|
|
branch = '0.1.x',
|
|
dependencies = {
|
|
'nvim-lua/plenary.nvim',
|
|
{
|
|
'nvim-telescope/telescope-fzf-native.nvim',
|
|
build = 'make',
|
|
cond = function()
|
|
return vim.fn.executable('make') == 1
|
|
end,
|
|
},
|
|
},
|
|
config = function()
|
|
local telescope = require('telescope')
|
|
local actions = require('telescope.actions')
|
|
|
|
telescope.setup({
|
|
defaults = {
|
|
-- Minimal UI, keep it clean
|
|
prompt_prefix = '> ',
|
|
selection_caret = '> ',
|
|
path_display = { 'truncate' },
|
|
|
|
-- Sensible default mappings
|
|
mappings = {
|
|
i = {
|
|
['<C-n>'] = actions.move_selection_next,
|
|
['<C-p>'] = actions.move_selection_previous,
|
|
['<C-c>'] = actions.close,
|
|
['<C-j>'] = actions.move_selection_next,
|
|
['<C-k>'] = actions.move_selection_previous,
|
|
['<CR>'] = actions.select_default,
|
|
['<C-x>'] = actions.select_horizontal,
|
|
['<C-v>'] = actions.select_vertical,
|
|
['<C-t>'] = actions.select_tab,
|
|
},
|
|
n = {
|
|
['<esc>'] = actions.close,
|
|
['<CR>'] = actions.select_default,
|
|
['<C-x>'] = actions.select_horizontal,
|
|
['<C-v>'] = actions.select_vertical,
|
|
['<C-t>'] = actions.select_tab,
|
|
['j'] = actions.move_selection_next,
|
|
['k'] = actions.move_selection_previous,
|
|
},
|
|
},
|
|
},
|
|
pickers = {
|
|
-- Keep pickers minimal, use defaults
|
|
find_files = {
|
|
theme = 'dropdown',
|
|
previewer = false,
|
|
},
|
|
buffers = {
|
|
theme = 'dropdown',
|
|
previewer = false,
|
|
mappings = {
|
|
i = {
|
|
['<C-d>'] = actions.delete_buffer,
|
|
},
|
|
},
|
|
},
|
|
},
|
|
extensions = {
|
|
-- fzf-native configuration (faster sorting)
|
|
fzf = {
|
|
fuzzy = true,
|
|
override_generic_sorter = true,
|
|
override_file_sorter = true,
|
|
case_mode = 'smart_case',
|
|
},
|
|
},
|
|
})
|
|
|
|
-- Load fzf extension if available
|
|
pcall(telescope.load_extension, 'fzf')
|
|
end,
|
|
keys = {
|
|
-- Find files in current working directory
|
|
{ '<leader>ff', '<cmd>Telescope find_files<cr>', desc = 'Telescope: Find files' },
|
|
|
|
-- Live grep (search text across project)
|
|
{ '<leader>fg', '<cmd>Telescope live_grep<cr>', desc = 'Telescope: Live grep' },
|
|
|
|
-- Search in open buffers
|
|
{ '<leader>fb', '<cmd>Telescope buffers<cr>', desc = 'Telescope: Find buffers' },
|
|
|
|
-- Search help tags
|
|
{ '<leader>fh', '<cmd>Telescope help_tags<cr>', desc = 'Telescope: Find help' },
|
|
|
|
-- Recent files
|
|
{ '<leader>fr', '<cmd>Telescope oldfiles<cr>', desc = 'Telescope: Recent files' },
|
|
|
|
-- Search current buffer
|
|
{ '<leader>/', '<cmd>Telescope current_buffer_fuzzy_find<cr>', desc = 'Telescope: Search buffer' },
|
|
|
|
-- Search keymaps
|
|
{ '<leader>fk', '<cmd>Telescope keymaps<cr>', desc = 'Telescope: Find keymaps' },
|
|
{ '<leader>?', '<cmd>Telescope keymaps<cr>', desc = 'Telescope: Find keymaps' },
|
|
|
|
-- LSP-related pickers (optional, for when LSP is active)
|
|
{ '<leader>fs', '<cmd>Telescope lsp_document_symbols<cr>', desc = 'Telescope: Document symbols' },
|
|
{ '<leader>fS', '<cmd>Telescope lsp_dynamic_workspace_symbols<cr>', desc = 'Telescope: Workspace symbols' },
|
|
},
|
|
},
|
|
}
|