Dotfiles_nvim/lua/editor/search.lua

70 lines
2.2 KiB
Lua
Raw Normal View History

2024-09-08 01:50:39 +02:00
local K = require('core.keymap')
2024-07-02 23:52:43 +02:00
return {
2025-02-26 22:26:45 +01:00
{
'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({}),
},
2024-07-02 23:52:43 +02:00
},
2025-02-26 22:26:45 +01:00
})
require('telescope').load_extension('ui-select')
2024-07-02 23:52:43 +02:00
2025-02-26 22:26:45 +01:00
-- Keybinding --
local function setTelescopeBinding(mapping, method, search_global)
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(
mapping.mode,
mapping.shortcut,
binding,
{ desc = mapping.description }
)
2024-07-02 23:52:43 +02:00
end
2025-02-26 22:26:45 +01:00
local telescope = require('telescope.builtin')
setTelescopeBinding(K.SEARCH.FIND_FILE, telescope.find_files, false)
setTelescopeBinding(K.SEARCH.FUZZY_FIND, telescope.live_grep, false)
setTelescopeBinding(
K.SEARCH.GLOBAL_FIND_FILE,
telescope.find_files,
true
)
setTelescopeBinding(
K.SEARCH.GLOBAL_FUZZY_FIND,
telescope.live_grep,
true
)
end,
},
{
'ibhagwan/fzf-lua',
dependencies = { 'nvim-tree/nvim-web-devicons' },
config = function()
local fzf = require('fzf-lua')
fzf.setup({})
2024-07-02 23:52:43 +02:00
2025-02-26 22:26:45 +01:00
vim.keymap.set(
K.SEARCH.SYMBOLS.mode,
K.SEARCH.SYMBOLS.shortcut,
fzf.lsp_live_workspace_symbols,
{ desc = K.SEARCH.SYMBOLS.description }
)
end,
},
2024-07-02 23:52:43 +02:00
}