forked from NormalNvim/NormalNvim
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path4-dev.lua
More file actions
499 lines (474 loc) · 15.2 KB
/
Copy path4-dev.lua
File metadata and controls
499 lines (474 loc) · 15.2 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
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
-- Dev
-- Things you actively use for coding.
-- Sections:
-- ## COMMENTS
-- -> comment.nvim [adv. comments]
-- ## SNIPPETS
-- -> luasnip [snippet engine]
-- -> friendly-snippets [snippet templates]
-- ## GIT
-- -> gitsigns.nvim [git hunks]
-- -> fugitive.vim [git commands]
-- ## DEBUGGER
-- -> nvim-dap [debugger]
-- ## COMPILER
-- -> compiler.nvim [compiler]
-- -> overseer.nvim [task runner]
-- ## TESTING
-- -> neotest.nvim [unit testing]
-- ## ANALYZER
-- -> aerial.nvim [code analyzer]
-- ## CODE DOCUMENTATION
-- -> vim-doxigen [general doc generator]
-- -> vim-typedoc [typescript doc generator]
-- -> markdown-preview.nvim [markdown previewer]
-- -> markmap.nvim [markdown mindmap]
-- ## ARTIFICIAL INTELLIGENCE
-- -> guess-indent [guess-indent]
-- -> neural [chatgpt code generator]
-- ## NOT INSTALLED
-- -> distant.nvim [ssh to edit in a remove machine]
local get_icon = require("base.utils").get_icon
return {
-- COMMENTS ----------------------------------------------------------------
-- Advanced comment features [adv. comments]
-- https://github.com/numToStr/Comment.nvim
{
"numToStr/Comment.nvim",
keys = {
{ "gc", mode = { "n", "v" }, desc = "Comment toggle linewise" },
{ "gb", mode = { "n", "v" }, desc = "Comment toggle blockwise" },
},
opts = function()
local commentstring_avail, commentstring =
pcall(require, "ts_context_commentstring.integrations.comment_nvim")
return commentstring_avail
and commentstring
and { pre_hook = commentstring.create_pre_hook() }
or {}
end,
},
-- SNIPPETS ----------------------------------------------------------------
-- Vim Snippets engine [snippet engine] + [snippet templates]
-- https://github.com/L3MON4D3/LuaSnip
-- https://github.com/rafamadriz/friendly-snippets
{
"L3MON4D3/LuaSnip",
build = vim.fn.has "win32" ~= 0
and "echo 'NOTE: jsregexp is optional, so not a big deal if it fails to build\n'; make install_jsregexp"
or nil,
dependencies = {
"zeioth/friendly-snippets",
"benfowler/telescope-luasnip.nvim",
},
config = function(_, opts)
if opts then require("luasnip").config.setup(opts) end
vim.tbl_map(
function(type) require("luasnip.loaders.from_" .. type).lazy_load() end,
{ "vscode", "snipmate", "lua" }
)
-- friently-snippets - enable standardized comments snippets
require("luasnip").filetype_extend("typescript", { "tsdoc" })
require("luasnip").filetype_extend("javascript", { "jsdoc" })
require("luasnip").filetype_extend("lua", { "luadoc" })
require("luasnip").filetype_extend("python", { "pydoc" })
require("luasnip").filetype_extend("rust", { "rustdoc" })
require("luasnip").filetype_extend("cs", { "csharpdoc" })
require("luasnip").filetype_extend("java", { "javadoc" })
require("luasnip").filetype_extend("c", { "cdoc" })
require("luasnip").filetype_extend("cpp", { "cppdoc" })
require("luasnip").filetype_extend("php", { "phpdoc" })
require("luasnip").filetype_extend("kotlin", { "kdoc" })
require("luasnip").filetype_extend("ruby", { "rdoc" })
require("luasnip").filetype_extend("sh", { "shelldoc" })
--require("luasnip").filetype_extend("shell", { "doxygen" })
end,
},
-- Telescope integration (:Telescope luasnip)
-- Note: It only shows the available snippets for the current language.
{
"nvim-telescope/telescope.nvim",
opts = function() require("telescope").load_extension "luasnip" end,
},
-- GIT ---------------------------------------------------------------------
-- Git signs [git hunks]
-- https://github.com/lewis6991/gitsigns.nvim
{
"lewis6991/gitsigns.nvim",
enabled = vim.fn.executable "git" == 1,
event = "User BaseGitFile",
opts = {
signs = {
add = { text = get_icon "GitSign" },
change = { text = get_icon "GitSign" },
delete = { text = get_icon "GitSign" },
topdelete = { text = get_icon "GitSign" },
changedelete = { text = get_icon "GitSign" },
untracked = { text = get_icon "GitSign" },
},
},
},
-- Git fugitive mergetool + [git commands]
-- https://github.com/lewis6991/gitsigns.nvim
-- PR needed: Setup keymappings to move quickly when using this feature.
--
-- We only want this plugin to use it as mergetool like "git mergetool".
-- To enable this feature, add this to your global .gitconfig:
--
-- [mergetool "fugitive"]
-- cmd = nvim -c \"Gvdiffsplit!\" \"$MERGED\"
-- [merge]
-- tool = fugitive
-- [mergetool]
-- keepBackup = false
{
"https://github.com/tpope/vim-fugitive",
enabled = vim.fn.executable "git" == 1,
dependencies = { "tpope/vim-rhubarb" },
cmd = {
"Gvdiffsplit",
"Gdiffsplit",
"Gedit",
"Gsplit",
"Gread",
"Gwrite",
"Ggrep",
"GMove",
"GRename",
"GDelete",
"GRemove",
"GBrowse",
"Git",
"Gstatus",
},
event = "User BaseGitFile",
init = function() vim.g.fugitive_no_maps = 1 end,
},
-- DEBUGGER ----------------------------------------------------------------
-- Debugger alternative to vim-inspector [debugger]
-- https://github.com/mfussenegger/nvim-dap
{
"mfussenegger/nvim-dap",
enabled = vim.fn.has "win32" == 0,
dependencies = {
{
"jay-babu/mason-nvim-dap.nvim",
dependencies = { "nvim-dap" },
cmd = { "DapInstall", "DapUninstall" },
opts = { handlers = {} },
},
{
"rcarriga/nvim-dap-ui",
opts = { floating = { border = "rounded" } },
config = function(_, opts)
local dap, dapui = require "dap", require "dapui"
dap.listeners.after.event_initialized["dapui_config"] = function(
)
dapui.open()
end
dap.listeners.before.event_terminated["dapui_config"] = function(
)
dapui.close()
end
dap.listeners.before.event_exited["dapui_config"] = function()
dapui.close()
end
dapui.setup(opts)
end,
},
{
"rcarriga/cmp-dap",
dependencies = { "nvim-cmp" },
config = function()
require("cmp").setup.filetype(
{ "dap-repl", "dapui_watches", "dapui_hover" },
{
sources = {
{ name = "dap" },
},
}
)
end,
},
},
event = "User BaseFile",
},
-- COMPILER ----------------------------------------------------------------
{
"Zeioth/compiler.nvim",
cmd = {"CompilerOpen", "CompilerToggleResults"},
dependencies = { "stevearc/overseer.nvim" },
config = function(_, opts) require("compiler").setup(opts) end,
},
{
"stevearc/overseer.nvim",
cmd = {"CompilerOpen", "CompilerToggleResults"},
opts = {
-- Tasks are disposed 5 minutes after running to free resources.
-- If you need to close a task inmediatelly:
-- press ENTER in the outut menu on the task you wanna close.
task_list = { -- this refers to the window that shows the result
direction = "bottom",
min_height = 25,
max_height = 25,
default_detail = 1,
bindings = {
["q"] = function() vim.cmd("OverseerClose") end ,
}
},
-- component_aliases = { -- uncomment this to disable notifications
-- -- Components included in default will apply to all tasks
-- default = {
-- { "display_duration", detail_level = 2 },
-- "on_output_summarize",
-- "on_exit_set_status",
-- "on_complete_notify",
-- "on_complete_dispose",
-- },
-- },
},
config = function(_, opts) require("overseer").setup(opts) end,
},
-- TESTING ----------------------------------------------------------------
-- Run tests inside of nvim [unit testing]
-- https://github.com/nvim-neotest/neotest
--
--
-- MANUAL:
-- -- Unit testing:
-- To tun an unit test you can run any of these commands:
--
-- :TestRunBlock -- Runs the nearest test to the cursor.
-- :TestStopBlock -- Stop the nearest test to the cursor.
-- :TestRunFile -- Run all tests in the file.
-- :TestDebugBlock -- Debug the nearest test under the cursor using dap
--
-- All this commands are meant to be executed in a test file.
-- You can find them on ../base/3-autocmds.lua
--
-- -- E2e and Test Suite
-- Normally you will prefer to open your e2e framework GUI outside of nvim.
-- But you have the next commands in ../base/3-autocmds.lua:
--
-- :TestNodejs -- Run all tests for this nodejs project.
-- :TestNodejsE2e -- Run the e2e tests/suite for this nodejs project.
{
"nvim-neotest/neotest",
cmd = { -- All this commands are meant to run in a test file
"TestRunBlock", -- Run the nearest test to the cursor.
"TestStopBlock", -- Stop the test to the cursor.
"TestDebugBlock", -- Debug the nearest test under the cursor using dap.
"TestRunFile", -- Run all tests in the file.
},
config = function()
-- get neotest namespace (api call creates or returns namespace)
local neotest_ns = vim.api.nvim_create_namespace "neotest"
vim.diagnostic.config({
virtual_text = {
format = function(diagnostic)
local message = diagnostic.message
:gsub("\n", " ")
:gsub("\t", " ")
:gsub("%s+", " ")
:gsub("^%s+", "")
return message
end,
},
}, neotest_ns)
require("neotest").setup {
-- your neotest config here
adapters = {
require "neotest-dotnet",
require "neotest-python",
require "neotest-rust",
require "neotest-go",
require "neotest-jest",
require "neotest-minitest",
require "neotest-rspec",
require "neotest-vitest",
require "neotest-testthat",
require "neotest-phpunit",
require "neotest-pest",
},
}
end,
dependencies = {
"Issafalcon/neotest-dotnet",
"nvim-neotest/neotest-python",
"rouge8/neotest-rust",
"nvim-neotest/neotest-go",
"nvim-neotest/neotest-jest",
"zidhuss/neotest-minitest",
"olimorris/neotest-rspec",
"marilari88/neotest-vitest",
"shunsambongi/neotest-testthat",
"olimorris/neotest-phpunit",
"theutz/neotest-pest",
},
},
-- Shows a float panel with the [code coverage]
-- https://github.com/andythigpen/nvim-coverage
--
-- Your project must generate coverage/lcov.info for this to work.
--
-- On jest, make sure your packages.json file has this:
-- "tests": "jest --coverage"
--
-- If you use other framework or language, refer to nvim-coverage docs:
-- https://github.com/andythigpen/nvim-coverage/blob/main/doc/nvim-coverage.txt
{
"andythigpen/nvim-coverage",
cmd = {
"Coverage",
"CoverageLoad",
"CoverageLoadLcov",
"CoverageShow",
"CoverageHide",
"CoverageToggle",
"CoverageClear",
"CoverageSummary",
},
config = function() require("coverage").setup() end,
requires = { "nvim-lua/plenary.nvim" },
},
-- ANALYZER ----------------------------------------------------------------
-- [code analyzer]
-- https://github.com/stevearc/aerial.nvim
{
"stevearc/aerial.nvim",
event = "User BaseFile",
cmd = {
"AerialToggle",
"AerialOpen",
"AerialNavOpen",
"AerialInfo",
"AerialClose",
},
opts = {
open_automatic = false, -- Open if the buffer is compatible
attach_mode = "global",
backends = { "lsp", "treesitter", "markdown", "man" },
layout = { min_width = 28 },
show_guides = true,
filter_kind = false,
guides = {
mid_item = "├ ",
last_item = "└ ",
nested_top = "│ ",
whitespace = " ",
},
keymaps = {
["[y"] = "actions.prev",
["]y"] = "actions.next",
["[Y"] = "actions.prev_up",
["]Y"] = "actions.next_up",
["{"] = false,
["}"] = false,
["[["] = false,
["]]"] = false,
},
},
},
-- Telescope integration (:Telescope aerial)
{
"nvim-telescope/telescope.nvim",
dependencies = {"stevearc/aerial.nvim"},
cmd = {
"AerialToggle",
"AerialOpen",
"AerialNavOpen",
"AerialInfo",
"AerialClose",
},
opts = function() require("telescope").load_extension "aerial" end,
},
-- CODE DOCUMENTATION ------------------------------------------------------
-- vim-doxygen
-- https://github.com/Zeioth/vim-doxygen
{
"Zeioth/vim-doxygen",
tf = {
"c",
"cpp",
"cs",
"python",
"d",
"fortran",
"java",
"perl",
"vhdl",
"objc",
"php",
},
cmd = {
"TypedocOpen",
"TypedocRegen",
},
},
-- vim-typedoc
-- https://github.com/Zeioth/vim-typedoc
{
"Zeioth/vim-doxygen",
tf = { "typescript" },
cmd = {
"DoxygenOpen",
"DoxygenRegen",
},
},
-- [markdown previewer]
-- https://github.com/iamcco/markdown-preview.nvim
-- Note: If you change the build command, wipe ~/.local/data/nvim/lazy
{
"iamcco/markdown-preview.nvim",
ft = "markdown",
cmd = {
"MarkdownPreview",
"MarkdownPreviewStop",
"MarkdownPreviewToggle",
},
build = "cd app && yarn install",
},
-- [markdown markmap]
-- https://github.com/Zeioth/markmap.nvim
-- Note: If you change the build command, wipe ~/.local/data/nvim/lazy
{
"Zeioth/markmap.nvim",
build = "yarn global add markmap-cli",
cmd = { "MarkmapOpen", "MarkmapSave", "MarkmapWatch", "MarkmapWatchStop" },
config = function(_, opts) require("markmap").setup(opts) end,
},
-- ARTIFICIAL INTELIGENCE -------------------------------------------------
-- [guess-indent]
-- https://github.com/NMAC427/guess-indent.nvim
-- Note that this plugin won't autoformat the code.
-- It just set the buffer options to tabuate in a certain way.
{
"NMAC427/guess-indent.nvim",
event = "User BaseFile",
config = function(_, opts)
require("guess-indent").setup(opts)
vim.cmd.lua {
args = { "require('guess-indent').set_from_buffer('auto_cmd')" },
mods = { silent = true },
}
end,
},
-- neural [chatgpt code generator]
-- https://github.com/dense-analysis/neural
{
"dense-analysis/neural",
cmd = { "Neural" },
config = function()
require("neural").setup {
source = {
openai = {
api_key = vim.env.OPENAI_API_KEY,
},
},
ui = {
prompt_icon = ">",
},
}
end,
},
}