89 lines
3.4 KiB
Lua
89 lines
3.4 KiB
Lua
|
return {
|
||
|
'nvim-telescope/telescope.nvim',
|
||
|
dependencies = {
|
||
|
'nvim-lua/plenary.nvim',
|
||
|
'nvim-telescope/telescope-fzy-native.nvim',
|
||
|
},
|
||
|
opts = {
|
||
|
defaults = {
|
||
|
file_ignore_patterns = {
|
||
|
".cache/.*",
|
||
|
"node_modules/.*",
|
||
|
".git/.*",
|
||
|
"Venv/.*",
|
||
|
"venv/.*",
|
||
|
"wandb/.*",
|
||
|
"Resources/.*",
|
||
|
"build/.*"
|
||
|
},
|
||
|
mappings = {
|
||
|
i = {
|
||
|
["jj"] = require("telescope.actions").close,
|
||
|
["<C-j>"] = require("telescope.actions").move_selection_next,
|
||
|
["<C-k>"] = require("telescope.actions").move_selection_previous,
|
||
|
},
|
||
|
},
|
||
|
file_sorter = require'telescope.sorters'.get_fzy_sorter,
|
||
|
generic_sorter = require'telescope.sorters'.get_fzy_sorter,
|
||
|
},
|
||
|
extensions = {
|
||
|
undo = {
|
||
|
side_by_side = false,
|
||
|
layout_strategy = "vertical",
|
||
|
use_delta = true,
|
||
|
layout_config = {
|
||
|
preview_height = 0.5,
|
||
|
},
|
||
|
mappings = {
|
||
|
i = {
|
||
|
["<cr>"] = require("telescope-undo.actions").restore,
|
||
|
["<S-y>"] = require("telescope-undo.actions").yank_additions,
|
||
|
},
|
||
|
},
|
||
|
|
||
|
}
|
||
|
},
|
||
|
fzy_native = {
|
||
|
override_generic_sorter = false,
|
||
|
override_file_sorter = true,
|
||
|
}
|
||
|
},
|
||
|
keys = {
|
||
|
{ "<leader>u", require("telescope").extensions.undo.undo},
|
||
|
{ "<C-Space>", require("telescope.builtin").oldfiles},
|
||
|
{ "<C-f>", function () require"telescope.builtin".live_grep({ path_display = { 'smart' }, }) end},
|
||
|
{ "<C-p>", function () -- git files
|
||
|
local opts = require('telescope.themes').get_ivy({})
|
||
|
opts["show_untracked"] = true
|
||
|
opts["layout_config"] = {height=0.2}
|
||
|
if not pcall(require"telescope.builtin".git_files, opts) then
|
||
|
require"telescope.builtin".find_files(opts)
|
||
|
end
|
||
|
end},
|
||
|
{ "<C-o>", function () -- project files
|
||
|
local opts = require('telescope.themes').get_ivy({})
|
||
|
opts["layout_config"] = {height=0.2}
|
||
|
require"telescope.builtin".find_files(opts)
|
||
|
end},
|
||
|
{ "<C-S-o>", function () -- buffer files
|
||
|
local opts = require('telescope.themes').get_ivy({})
|
||
|
opts["layout_config"] = {height=0.2}
|
||
|
require"telescope.builtin".buffers(opts)
|
||
|
end},
|
||
|
{ "<C-S-f>", function () -- fuzzy search
|
||
|
require"telescope.builtin".grep_string({
|
||
|
path_display = { 'smart' },
|
||
|
only_sort_text = true,
|
||
|
word_match = "-w",
|
||
|
search = '',
|
||
|
})
|
||
|
end},
|
||
|
},
|
||
|
config = function (_, opts)
|
||
|
local telescope = require("telescope")
|
||
|
telescope.setup(opts)
|
||
|
telescope.load_extension("undo")
|
||
|
telescope.load_extension('fzy_native')
|
||
|
end
|
||
|
}
|