1
0
Fork 1
Dotfiles_nvim/lua/editor/search.lua

69 lines
1.7 KiB
Lua
Raw Normal View History

2024-07-02 21:52:43 +00:00
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,
}