-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patheditor.lua
More file actions
315 lines (303 loc) · 9.97 KB
/
editor.lua
File metadata and controls
315 lines (303 loc) · 9.97 KB
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
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
return {
{
enabled = false,
"folke/flash.nvim",
---@type Flash.Config
opts = {
search = {
forward = true,
multi_window = false,
wrap = false,
incremental = true,
},
},
keys = {
{
"s",
mode = { "n", "x", "o" },
function()
require("flash").jump()
end,
desc = "Flash",
},
{
"S",
mode = { "n", "x", "o" },
function()
require("flash").treesitter()
end,
desc = "Flash Treesitter",
},
{
"r",
mode = "o",
function()
require("flash").remote()
end,
desc = "Remote Flash",
},
{
"R",
mode = { "o", "x" },
function()
require("flash").treesitter_search()
end,
desc = "Treesitter Search",
},
{
"<c-s>",
mode = { "c" },
function()
require("flash").toggle()
end,
desc = "Toggle Flash Search",
},
},
},
{
"echasnovski/mini.hipatterns",
event = "BufReadPre",
opts = {
highlighters = {
hsl_color = {
pattern = "hsl%(%d+,? %d+%%?,? %d+%%?%)",
group = function(_, match)
local utils = require("solarized-osaka.hsl")
--- @type string, string, string
local nh, ns, nl = match:match("hsl%((%d+),? (%d+)%%?,? (%d+)%%?%)")
--- @type number?, number?, number?
local h, s, l = tonumber(nh), tonumber(ns), tonumber(nl)
--- @type string
local hex_color = utils.hslToHex(h, s, l)
return MiniHipatterns.compute_hex_color_group(hex_color, "bg")
end,
},
},
},
},
{
"dinhhuy258/git.nvim",
event = "BufReadPre",
opts = {
keymaps = {
-- Open blame window
blame = "<Leader>gb",
-- Open file/folder in git repository
browse = "<Leader>go",
},
},
},
{
"nvim-telescope/telescope.nvim",
dependencies = {
{
"nvim-telescope/telescope-fzf-native.nvim",
build = "make",
},
"nvim-telescope/telescope-file-browser.nvim",
},
keys = {
{ "<leader><space>", false },
{ "<leader>/", false },
{
"<leader>fP",
function()
require("telescope.builtin").find_files({
cwd = require("lazy.core.config").options.root,
})
end,
desc = "Find Plugin File",
},
{
";f",
function()
local builtin = require("telescope.builtin")
builtin.find_files({
no_ignore = false,
hidden = true,
})
end,
desc = "Lists files in your current working directory, respects .gitignore",
},
{
";r",
function()
local builtin = require("telescope.builtin")
builtin.live_grep({
additional_args = { "--hidden" },
})
end,
desc = "Search for a string in your current working directory and get results live as you type, respects .gitignore",
},
{
"\\\\",
function()
local builtin = require("telescope.builtin")
builtin.buffers()
end,
desc = "Lists open buffers",
},
{
";t",
function()
local builtin = require("telescope.builtin")
builtin.help_tags()
end,
desc = "Lists available help tags and opens a new window with the relevant help info on <cr>",
},
{
";;",
function()
local builtin = require("telescope.builtin")
builtin.resume()
end,
desc = "Resume the previous telescope picker",
},
{
";e",
function()
local builtin = require("telescope.builtin")
builtin.diagnostics()
end,
desc = "Lists Diagnostics for all open buffers or a specific buffer",
},
{
";s",
function()
local builtin = require("telescope.builtin")
builtin.treesitter()
end,
desc = "Lists Function names, variables, from Treesitter",
},
},
opts = function(_, opts)
local telescope = require("telescope")
-- local actions = require("telescope.actions")
-- local fb_actions = require("telescope").extensions.file_browser.actions
if not opts.defaults then
opts.defaults = {
wrap_results = true,
layout_strategy = "horizontal",
layout_config = { prompt_position = "top" },
sorting_strategy = "ascending",
winblend = 0,
mappings = {
n = {},
},
}
else
table.insert(opts.defaults, {
wrap_results = true,
layout_strategy = "horizontal",
layout_config = { prompt_position = "top" },
sorting_strategy = "ascending",
winblend = 0,
mappings = {
n = {},
},
})
end
opts.pickers = {
diagnostics = {
theme = "ivy",
initial_mode = "normal",
layout_config = {
preview_cutoff = 9999,
},
},
}
opts.extensions = {
-- file_browser = {
-- theme = "dropdown",
-- -- disables netrw and use telescope-file-browser in its place
-- hijack_netrw = true,
-- mappings = {
-- -- your custom insert mode mappings
-- ["n"] = {
-- -- your custom normal mode mappings
-- ["N"] = fb_actions.create,
-- ["h"] = fb_actions.goto_parent_dir,
-- ["/"] = function()
-- vim.cmd("startinsert")
-- end,
-- ["<C-u>"] = function(prompt_bufnr)
-- for i = 1, 10 do
-- actions.move_selection_previous(prompt_bufnr)
-- end
-- end,
-- ["<C-d>"] = function(prompt_bufnr)
-- for i = 1, 10 do
-- actions.move_selection_next(prompt_bufnr)
-- end
-- end,
-- ["<PageUp>"] = actions.preview_scrolling_up,
-- ["<PageDown>"] = actions.preview_scrolling_down,
-- },
-- },
-- },
}
telescope.setup(opts)
require("telescope").load_extension("fzf")
-- require("telescope").load_extension("file_browser")
end,
},
{
"numToStr/Comment.nvim",
keys = {
{
"<C-c>",
"<cmd>lua require(\'Comment.api\').toggle.linewise()<CR>",
mode = "n",
desc = "Toggle Line Comment",
},
{
"<C-c>",
"<ESC><cmd>lua require(\'Comment.api\').toggle.linewise(vim.fn.visualmode())<CR>",
mode = "v",
desc = "Toggle Multi-Line Comment",
},
},
event = "BufReadPre",
dependencies = {
"JoosepAlviste/nvim-ts-context-commentstring",
},
config = function()
-- import comment plugin safely
local comment = require("Comment")
local ts_context_commentstring = require("ts_context_commentstring.integrations.comment_nvim")
-- enable comment
comment.setup({
-- for commenting tsx and jsx files
pre_hook = ts_context_commentstring.create_pre_hook(),
})
end,
},
{
"szw/vim-maximizer",
keys = {
{ "<F11>", "<cmd>MaximizerToggle<CR>", { desc = "Maximize/minimize a split" } },
},
},
-- { "wakatime/vim-wakatime", lazy = false },
{
"behzade/lf.nvim",
dependencies = {
"samjwill/nvim-unception",
},
},
{
"saghen/blink.cmp",
opts = {
completion = {
menu = {
winblend = vim.o.pumblend,
},
},
signature = {
window = {
winblend = vim.o.pumblend,
},
},
},
},
}