Dotfiles/.config/nvim/lua/plugins/search.lua

36 lines
1.3 KiB
Lua
Raw Normal View History

2024-05-13 18:43:31 +00:00
return {
"nvim-telescope/telescope.nvim",
tag = "0.1.5",
dependencies = {
"nvim-lua/plenary.nvim",
2024-06-02 17:11:54 +00:00
"nvim-telescope/telescope-ui-select.nvim",
2024-05-13 18:43:31 +00:00
},
config = function()
-- Setup --
require("telescope").setup({
extensions = {
["ui-select"] = {
require("telescope.themes").get_dropdown({}),
},
},
})
require("telescope").load_extension("ui-select")
-- Keybinding --
local function setTelescopeBinding(mode, keymap, method, search_global, description)
local function binding()
local path = search_global and "~" or require("neo-tree.sources.manager").get_state("filesystem").path
method({ search_dirs = { path } })
end
vim.keymap.set(mode, keymap, binding, { desc = description })
end
local telescope = require("telescope.builtin")
setTelescopeBinding("n", "<leader>ff", telescope.find_files, false, "Find File")
setTelescopeBinding("n", "<leader>fz", telescope.live_grep, false, "Fuzzy Find")
setTelescopeBinding("n", "<leader>gff", telescope.find_files, true, "Global Find File")
setTelescopeBinding("n", "<leader>gfz", telescope.live_grep, true, "Global Fuzzy Find")
2024-06-02 17:11:54 +00:00
end,
2024-05-13 18:43:31 +00:00
}