Add telescope

This commit is contained in:
Yan Lin 2025-08-14 09:07:42 +09:00
parent bc9c26c2b7
commit 04aeb9160e
2 changed files with 64 additions and 1 deletions

View file

@ -197,6 +197,7 @@ blog = {
#### Key Features:
- **File Explorer**: nvim-tree with dotfile filtering
- **Fuzzy Finder**: Telescope for fast file finding, text search, and navigation
- **Syntax Highlighting**: Treesitter with comprehensive language support
- **Git Integration**: vim-fugitive for git operations
- **Status Line**: lualine with gruvbox theme and relative paths
@ -221,12 +222,28 @@ blog = {
| `<Space>y` | Copy to system clipboard |
| `<Space>p` | Paste from system clipboard |
**Fuzzy Finding (Telescope):**
| Key | Action |
|-----|--------|
| `<Space>ff` | Find files in current directory |
| `<Space>fg` | Live grep - search text in all files |
| `<Space>fb` | Browse open buffers |
| `<Space>fh` | Search help documentation |
**Telescope Navigation:**
| Key | Action |
|-----|--------|
| `<C-j>/<C-k>` | Navigate up/down in results |
| `<CR>` | Open selected file |
| `<C-q>` | Send results to quickfix list |
| `<Esc>` | Close Telescope |
**Git Operations:**
| Key | Action |
|-----|--------|
| `<Space>gs` | Git status |
| `<Space>gd` | Git diff |
| `<Space>gc` | Git commit |
| `<Space>gc` | Git commit (vim-fugitive) |
| `<Space>gp` | Git push |
**Other:**

View file

@ -110,12 +110,42 @@
};
};
};
# Telescope - Fuzzy finder
telescope = {
enable = true;
keymaps = {
# Find files using Telescope command-line sugar
"<leader>ff" = "find_files";
"<leader>fg" = "live_grep";
"<leader>fb" = "buffers";
"<leader>fh" = "help_tags";
};
settings = {
defaults = {
file_ignore_patterns = [
"^.git/"
"^node_modules/"
"^target/"
"^dist/"
".DS_Store"
];
layout_config = {
prompt_position = "bottom";
horizontal = {
preview_width = 0.55;
};
};
};
};
};
};
# Extra plugins that don't have dedicated modules
extraPlugins = with pkgs.vimPlugins; [
vim-fugitive
cmp-dictionary
plenary-nvim # Required dependency for telescope
];
# Keymaps
@ -225,6 +255,22 @@
first_case_insensitive = true, -- Case insensitive matching
})
-- Telescope setup for better file finding
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_selected_to_qflist + actions.open_qflist,
}
}
}
}
-- Unicode-safe file operations for macOS
function open_file_with_system_app()
local filepath = vim.fn.expand('%:p')