37 lines
1.3 KiB
Lua
37 lines
1.3 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 --
|
||
|
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")
|
||
|
|
||
|
end
|
||
|
}
|