-
Notifications
You must be signed in to change notification settings - Fork 0
/
telescope.lua
214 lines (207 loc) · 7.29 KB
/
telescope.lua
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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
return {
{
'nvim-telescope/telescope.nvim',
dependencies = { 'nvim-lua/plenary.nvim', 'EdenEast/nightfox.nvim' },
init = function()
local hl = vim.api.nvim_set_hl
local p = require('nightfox.palette').load('carbonfox')
hl(0, 'TelescopePreviewBorder', { fg = p.blue.dim })
hl(0, 'TelescopePreviewTitle', { fg = p.blue.base })
hl(0, 'TelescopePromptBorder', { fg = p.cyan.dim })
hl(0, 'TelescopePromptTitle', { fg = p.cyan.bright })
hl(0, 'TelescopeResultsBorder', { fg = p.orange.dim })
hl(0, 'TelescopeResultsTitle', { fg = p.orange.bright })
end,
keys = {
-- f
{
'<leader>ff',
function() require('telescope.builtin').find_files() end,
desc = 'Find files',
},
{
'<leader>fF',
function()
require('telescope.builtin').find_files({
hidden = true,
no_ignore = true,
})
end,
desc = 'Find files (hidden)',
},
{
'<leader>fb',
function()
require('telescope.builtin').buffers({
ignore_current_buffer = true,
sort_mru = true,
})
end,
desc = 'Find buffers',
},
-- s
{
'<leader>sb',
function()
require('telescope.builtin').current_buffer_fuzzy_find()
end,
desc = 'Search buffer',
},
{
'<leader>sg',
function()
require('telescope.builtin').live_grep({
additional_args = { '--no-ignore' },
})
end,
desc = 'Grep files',
},
{
'<leader>sG',
function()
require('telescope.builtin').live_grep({
grep_open_files = true,
})
end,
desc = 'Grep files (Open files)',
},
{
'<leader>sh',
function() require('telescope.builtin').help_tags() end,
desc = 'Search help tags',
},
{
'<leader>sH',
function() require('telescope.builtin').highlights() end,
desc = 'Search highlights',
},
{
'<leader>sw',
function()
require('telescope.builtin').grep_string({
word_match = '-w',
})
end,
desc = 'Search word',
},
{
'<leader>sw',
function()
require('telescope.builtin').grep_string({
word_match = '-w',
})
end,
mode = 'v',
desc = 'Search selection',
},
{
'<leader>R',
function() require('telescope.builtin').resume() end,
desc = 'Resume',
},
},
opts = {
defaults = {
-- use square corners
borderchars = {
'─',
'│',
'─',
'│',
'┌',
'┐',
'┘',
'└',
},
mappings = {
i = {
['<c-h>'] = 'select_horizontal',
['<c-x>'] = 'which_key',
},
},
},
},
},
-- native fuzzy search for telescope
{
'nvim-telescope/telescope-fzf-native.nvim',
build = 'cmake -S. -Bbuild -DCMAKE_BUILD_TYPE=Release && cmake --build build --config Release && cmake --install build --prefix build',
dependencies = {
'nvim-telescope/telescope.nvim',
opts = { extensions = { fzf = {} } },
},
init = function() require('telescope').load_extension('fzf') end,
},
-- telescope undo extension
{
'debugloop/telescope-undo.nvim',
dependencies = {
'nvim-telescope/telescope.nvim',
opts = {
extensions = {
undo = {
use_delta = false,
layout_config = {
preview_width = 0.75,
},
mappings = {
i = {
['<cr>'] = function(...)
return require('telescope-undo.actions').yank_additions(
...
)
end,
['<c-y>'] = function(...)
return require('telescope-undo.actions').yank_deletions(
...
)
end,
['<c-r>'] = function(...)
return require('telescope-undo.actions').restore(
...
)
end,
},
n = {
['y'] = function(...)
return require('telescope-undo.actions').yank_additions(
...
)
end,
['Y'] = function(...)
return require('telescope-undo.actions').yank_deletions(
...
)
end,
['r'] = function(...)
return require('telescope-undo.actions').restore(
...
)
end,
},
},
},
},
pickers = {
lsp_document_symbols = {
symbol_width = 50, -- allow more room for symbol name
},
diagnostics = {
layout_strategy = 'vertical',
layout_config = {
preview_height = 0.65,
},
},
},
},
},
init = function() require('telescope').load_extension('undo') end,
keys = {
{
'<leader>su',
function() require('telescope').extensions.undo.undo({}) end,
desc = 'Search undo history',
},
},
},
}