1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
|
local state = require "state"
return {
"nvim-telescope/telescope.nvim",
opts = function(_, opts)
local actions = require "telescope.actions"
local actions_mt = require "telescope.actions.mt"
local open_quickfix = actions_mt.transform("open_quickfix", actions_mt.create(), nil, {
action = function()
require("trouble").open "qflist"
end,
})
return vim.tbl_deep_extend("force", opts, {
defaults = {
mappings = {
n = {
["<C-q>"] = actions.send_to_qflist + open_quickfix,
["<C-h>"] = "preview_scrolling_left",
["<C-k>"] = "preview_scrolling_up",
["<C-j>"] = "preview_scrolling_down",
["<C-l>"] = "preview_scrolling_right",
},
i = {
["<C-q>"] = actions.send_to_qflist + open_quickfix,
["<C-h>"] = "preview_scrolling_left",
["<C-k>"] = "preview_scrolling_up",
["<C-j>"] = "preview_scrolling_down",
["<C-l>"] = "preview_scrolling_right",
},
},
},
})
end,
dependencies = {
"nvim-lua/plenary.nvim",
},
keys = function()
local builtin = require "telescope.builtin"
return {
{ "<Leader>ff", builtin.find_files, desc = "Telescope: find files" },
{
"<Leader>fF",
function()
builtin.find_files(state.nvim_tree_root and {
cwd = state.nvim_tree_root,
})
end,
desc = "Telescope: find files in nvim-tree root",
},
{ "<Leader>fg", builtin.live_grep, desc = "Telescope: live grep" },
{
"<Leader>fG",
function()
builtin.live_grep(state.nvim_tree_root and {
cwd = state.nvim_tree_root,
})
end,
desc = "Telescope: live grep in nvim-tree root",
},
}
end,
cmd = { "Telescope" },
}
|