dotfiles/home/.config/nvim/lua/plugins/telescope.lua

104 lines
2.2 KiB
Lua
Raw Normal View History

2023-11-25 14:37:36 +02:00
--- @type LazyPluginSpec
return {
"nvim-telescope/telescope.nvim",
lazy = false,
dependencies = {
-- Internal dependency for telescope
"nvim-lua/plenary.nvim",
-- Use fzf for fuzzy finder
{
"nvim-telescope/telescope-fzf-native.nvim",
build = "make",
},
-- Replace vim built in select with telescope
"nvim-telescope/telescope-ui-select.nvim",
-- cd plugin for telescope
"zane-/cder.nvim",
-- Switch to a project
{
"ahmedkhalf/project.nvim",
main = "project_nvim",
config = true,
},
},
opts = {
-- Set layout to vertical
defaults = {
layout_strategy = "vertical",
layout_defaults = {
vertical = {
preview_height = 0.5,
},
},
},
2023-09-18 16:48:04 +03:00
pickers = {
find_files = { find_command = { "fd", "-Ht", "f" } },
lsp_references = { show_line = false },
live_grep = {
additional_args = function()
return { "--hidden" }
end,
},
},
extensions = {
cder = {
previewer_command = "eza "
.. "-a "
.. "--color=always "
.. "-T "
.. "--level=3 "
.. "--icons "
.. "--git-ignore "
.. "--long "
.. "--no-permissions "
.. "--no-user "
.. "--no-filesize "
.. "--git "
.. "--ignore-glob=.git",
dir_command = { "fd", "-Ht", "d", ".", os.getenv("HOME") },
},
2023-09-18 16:48:04 +03:00
},
},
keys = {
{
desc = "Open Telescope",
"<C-s>",
"<cmd>Telescope<cr>",
},
{
desc = "Change directories",
"cd",
"<cmd>Telescope cder<cr>",
},
{
desc = "Find files",
"<C-f>",
"<cmd>Telescope find_files<cr>",
},
{
desc = "Grep files",
"<C-g>",
"<cmd>Telescope live_grep<cr>",
},
{
desc = "Change to a project",
"<C-p>",
"<cmd>Telescope projects<cr>",
},
},
2023-11-18 02:54:35 +02:00
config = function(_, opts)
local telescope = require("telescope")
2023-11-18 02:54:35 +02:00
telescope.setup(opts)
-- Load extensions
telescope.load_extension("fzf")
telescope.load_extension("ui-select")
telescope.load_extension("cder")
telescope.load_extension("projects")
end,
}