Dotfiles/.config/nvim/lua/plugins/search.lua
2024-05-13 23:10:48 +02:00

60 lines
1.9 KiB
Lua

return {
"nvim-telescope/telescope.nvim",
tag = "0.1.5",
dependencies = {
"nvim-lua/plenary.nvim",
"nvim-telescope/telescope-ui-select.nvim"
},
config = function()
-- Setup --
require("telescope").setup({
extensions = {
["ui-select"] = {
require("telescope.themes").get_dropdown({}),
},
},
})
require("telescope").load_extension("ui-select")
-- Keybinding --
vim.keymap.set(
"n",
"<leader>ff",
function()
local telescope = require("telescope.builtin")
local state = require("neo-tree.sources.manager").get_state("filesystem")
telescope.find_files({ search_dirs = { state.path } })
end,
{ desc = "Find File" }
)
vim.keymap.set(
"n",
"<leader>fz",
function()
local telescope = require("telescope.builtin")
local state = require("neo-tree.sources.manager").get_state("filesystem")
telescope.live_grep({ search_dirs = { state.path } })
end,
{ desc = "Fuzzy Find" }
)
vim.keymap.set(
"n",
"<leader>gff",
function()
local telescope = require("telescope.builtin")
telescope.find_files({ search_dirs = { "~" } })
end,
{ desc = "Global Find File" }
)
vim.keymap.set(
"n",
"<leader>gfz",
function()
local telescope = require("telescope.builtin")
telescope.live_grep({ search_dirs = { "~" } })
end,
{ desc = "Global Fuzzy Find" }
)
end
}