From c46b0db519d87aac0969e56fbe42ba8906c232b8 Mon Sep 17 00:00:00 2001 From: ray Date: Sun, 7 Dec 2025 19:26:13 +0000 Subject: [PATCH] telescope configured --- MIGRATION_PLAN.md | 16 ++++-- lua/plugins/telescope.lua | 105 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 118 insertions(+), 3 deletions(-) create mode 100644 lua/plugins/telescope.lua diff --git a/MIGRATION_PLAN.md b/MIGRATION_PLAN.md index 6d70075..526ecc3 100644 --- a/MIGRATION_PLAN.md +++ b/MIGRATION_PLAN.md @@ -128,9 +128,19 @@ Source of truth for the step-by-step rebuild. Keep this concise and up to date. - [x] Tested and validated with test-gf.php ## Phase 4.3 — Telescope setup -- [ ] Add `telescope.nvim` + `telescope-fzf-native.nvim` for fuzzy finding -- [ ] Configure basic pickers: `find_files`, `live_grep`, `buffers`, `help_tags`, `oldfiles` -- [ ] Add sensible default keymaps +- [x] Add `telescope.nvim` + `telescope-fzf-native.nvim` for fuzzy finding +- [x] Configure basic pickers: `find_files`, `live_grep`, `buffers`, `help_tags`, `oldfiles`, `current_buffer_fuzzy_find` +- [x] Add LSP pickers: `lsp_document_symbols`, `lsp_workspace_symbols` +- [x] Keymaps configured: + - `ff` - Find files + - `fg` - Live grep (search text) + - `fb` - Find buffers (with `` to delete) + - `fh` - Find help + - `fr` - Recent files + - `/` - Search current buffer + - `fs` - Document symbols (LSP) + - `fS` - Workspace symbols (LSP) +- [x] Minimal UI: dropdown theme for files/buffers, no previewer for quick selection ## Phase 4.4 — Oil.nvim for file manipulation - [ ] Add `stevearc/oil.nvim` for filesystem operations (rename, create, delete, copy, move) diff --git a/lua/plugins/telescope.lua b/lua/plugins/telescope.lua new file mode 100644 index 0000000..bf4159d --- /dev/null +++ b/lua/plugins/telescope.lua @@ -0,0 +1,105 @@ +-- 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 = { + [''] = actions.move_selection_next, + [''] = actions.move_selection_previous, + [''] = actions.close, + [''] = actions.move_selection_next, + [''] = actions.move_selection_previous, + [''] = actions.select_default, + [''] = actions.select_horizontal, + [''] = actions.select_vertical, + [''] = actions.select_tab, + }, + n = { + [''] = actions.close, + [''] = actions.select_default, + [''] = actions.select_horizontal, + [''] = actions.select_vertical, + [''] = 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 = { + [''] = 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 + { 'ff', 'Telescope find_files', desc = 'Find files' }, + + -- Live grep (search text across project) + { 'fg', 'Telescope live_grep', desc = 'Live grep' }, + + -- Search in open buffers + { 'fb', 'Telescope buffers', desc = 'Find buffers' }, + + -- Search help tags + { 'fh', 'Telescope help_tags', desc = 'Find help' }, + + -- Recent files + { 'fr', 'Telescope oldfiles', desc = 'Recent files' }, + + -- Search current buffer + { '/', 'Telescope current_buffer_fuzzy_find', desc = 'Search buffer' }, + + -- LSP-related pickers (optional, for when LSP is active) + { 'fs', 'Telescope lsp_document_symbols', desc = 'Document symbols' }, + { 'fS', 'Telescope lsp_dynamic_workspace_symbols', desc = 'Workspace symbols (dynamic)' }, + }, + }, +}