Back to Blog

Neovim Telescope — Find Files, Live Grep, Buffers & Git Pickers | Episode 9

Sandy LaneSandy Lane

Video: Neovim Telescope — Find Files, Live Grep, Buffers & Git Pickers | Episode 9 by Taught by Celeste AI - AI Coding Coach

Watch full page →

Neovim Telescope — Find Files, Live Grep, Buffers & Git Pickers

Telescope is a powerful fuzzy finder plugin for Neovim that enhances navigation and searching inside your editor. By integrating telescope.nvim with plenary.nvim and telescope-fzf-native.nvim, you get blazing-fast file searching, live grep, buffer switching, and Git history exploration—all accessible via intuitive keymaps.

Code

-- Install plugins using your preferred plugin manager (example with packer.nvim)
require('packer').startup(function(use)
  use { 'nvim-telescope/telescope.nvim', branch = '0.1.x' }
  use 'nvim-lua/plenary.nvim'               -- required dependency
  use { 'nvim-telescope/telescope-fzf-native.nvim', run = 'make' }  -- native fzf sorter
end)

-- Telescope setup with fzf extension loaded
require('telescope').setup{
  defaults = {
    mappings = {
      i = {
        ["<C-x>"] = require('telescope.actions').file_split,    -- horizontal split
        ["<C-v>"] = require('telescope.actions').file_vsplit,   -- vertical split
      },
    },
  },
}
require('telescope').load_extension('fzf')

-- Keymaps for common pickers
local opts = { noremap = true, silent = true }
local builtin = require('telescope.builtin')
vim.api.nvim_set_keymap('n', 'ff', "lua require('telescope.builtin').find_files()", opts)
vim.api.nvim_set_keymap('n', 'fg', "lua require('telescope.builtin').live_grep()", opts)
vim.api.nvim_set_keymap('n', 'fb', "lua require('telescope.builtin').buffers()", opts)
vim.api.nvim_set_keymap('n', 'fh', "lua require('telescope.builtin').help_tags()", opts)
vim.api.nvim_set_keymap('n', 'fr', "lua require('telescope.builtin').oldfiles()", opts)
vim.api.nvim_set_keymap('n', 'fw', "lua require('telescope.builtin').grep_string()", opts)
vim.api.nvim_set_keymap('n', 'fc', "lua require('telescope.builtin').git_commits()", opts)
vim.api.nvim_set_keymap('n', 'fs', "lua require('telescope.builtin').git_status()", opts)

Key Points

  • Telescope.nvim provides a highly customizable fuzzy finder interface for files, buffers, and more within Neovim.
  • Plenary.nvim is a required utility library that telescope depends on for async and Lua functions.
  • Telescope-fzf-native.nvim speeds up sorting by using a native FZF algorithm, improving search responsiveness.
  • Common pickers like find_files, live_grep, buffers, and git_commits are bound to convenient keymaps for quick access.
  • Use Ctrl-x and Ctrl-v inside Telescope to open selections in horizontal or vertical splits without leaving the picker UI.