129 lines
2.9 KiB
Lua
129 lines
2.9 KiB
Lua
-- Install and configure Telescope
|
|
-- https://github.com/nvim-telescope/telescope.nvim
|
|
return {
|
|
"nvim-telescope/telescope.nvim",
|
|
branch = "0.1.x",
|
|
dependencies = {
|
|
"nvim-lua/plenary.nvim",
|
|
-- C implementation of fzf to improve performance
|
|
{
|
|
"nvim-telescope/telescope-fzf-native.nvim",
|
|
build = "make"
|
|
},
|
|
"nvim-tree/nvim-web-devicons",
|
|
|
|
-- Some missing dependendies ?
|
|
-- Extension to telescope to use Ag (or ripgrep) to filter results
|
|
-- 'kelly-lin/telescope-ag'
|
|
-- Allow to search for snippets
|
|
-- 'benfowler/telescope-luasnip.nvim'
|
|
-- Highlight, edit, and navigate code
|
|
-- 'nvim-treesitter/nvim-treesitter',
|
|
-- 'nvim-treesitter/nvim-treesitter-textobjects',
|
|
},
|
|
|
|
-- Configure Telescope
|
|
config = function()
|
|
local telescope = require("telescope")
|
|
local actions = require("telescope.actions")
|
|
|
|
telescope.setup({
|
|
defaults = {
|
|
|
|
-- Parce que c'est joli
|
|
prompt_prefix = " ",
|
|
selection_caret = " ",
|
|
path_display = { "smart" },
|
|
file_ignore_patterns = { ".git/", "node_modules" },
|
|
|
|
mappings = {
|
|
i = {
|
|
},
|
|
},
|
|
pickers = {
|
|
command_history = {
|
|
theme = "dropdown",
|
|
}
|
|
}
|
|
},
|
|
})
|
|
|
|
telescope.load_extension("fzf")
|
|
-- telescope.load_extension("luasnip")
|
|
-- telescope.load_extension("ag")
|
|
|
|
-- set keymaps
|
|
|
|
-- <leader>of for oldfiles
|
|
vim.keymap.set(
|
|
"n",
|
|
"<leader>of",
|
|
"<cmd>Telescope oldfiles<cr>",
|
|
{ desc = " [?] Find recently opened files " }
|
|
)
|
|
|
|
-- <leader>sb
|
|
vim.keymap.set(
|
|
"n",
|
|
"<leader>sb",
|
|
"<cmd>Telescope buffers<cr>",
|
|
{ desc = "[S]earch [B]uffers " }
|
|
)
|
|
|
|
-- <leader>/ to fuzzily search in current buffer
|
|
vim.keymap.set(
|
|
'n',
|
|
'<leader>/',
|
|
"<cmd>Telescope current_buffer_fuzzy_find<cr>",
|
|
{ desc = '[/] Fuzzily search in current buffer' })
|
|
|
|
-- <leader>sh to search help
|
|
vim.keymap.set(
|
|
"n",
|
|
"<leader>sh",
|
|
"<cmd>Telescope help_tags<cr>",
|
|
{ desc = "[S]earch [H]elp" }
|
|
)
|
|
|
|
-- <leader>sf to search files
|
|
vim.keymap.set(
|
|
"n",
|
|
"<leader>sf",
|
|
"<cmd>Telescope find_files<cr>",
|
|
{ desc = "[S]earch [F]iles" }
|
|
)
|
|
|
|
-- <leader>gf to search files in git history
|
|
vim.keymap.set(
|
|
"n",
|
|
"<leader>gf",
|
|
"<cmd>Telescope git_files<cr>",
|
|
{ desc = "Search [G]it [F]iles" }
|
|
)
|
|
|
|
-- <leader>sg to (rip)grep through files
|
|
vim.keymap.set(
|
|
"n",
|
|
"<leader>sg",
|
|
"<cmd>Telescope live_grep<cr>",
|
|
{ desc = "[S]earch by [G]rep" }
|
|
)
|
|
|
|
-- <leader>sw to search for other occurrences of the current word
|
|
vim.keymap.set(
|
|
"n",
|
|
"<leader>sw",
|
|
"<cmd>Telescope grep_string<cr>",
|
|
{ desc = "[S]earch current [W]ord" }
|
|
)
|
|
|
|
-- <leader>ch to search in the command history
|
|
vim.keymap.set(
|
|
"n",
|
|
"<leader>sw",
|
|
"<cmd>Telescope command_history<cr>",
|
|
{ desc = "[C]command [H]istory" }
|
|
)
|
|
end,
|
|
}
|