-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlazy.lua
More file actions
1420 lines (1340 loc) · 61.1 KB
/
Copy pathlazy.lua
File metadata and controls
1420 lines (1340 loc) · 61.1 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
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
-- This file can be loaded by calling `lua require('frostynick.plugins')` from your init.vimlaz
-- keys for vim https://vimdoc.sourceforge.net/htmldoc/intro.html#key-notation
-- Migration: Lazy <--> Packer https://github.com/folke/lazy.nvim#packernvim
-- local vim = vim -- possibly needed if using emmylua_ls
-- local Snacks = Snacks
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
local uv = vim.uv or vim.loop -- `vim.loop` planned to be removed in nvim 1.0 as of 2024-11-1
if not uv.fs_stat(lazypath) then
vim.fn.system({
"git", "clone", "--filter=blob:none",
"https://github.com/folke/lazy.nvim.git",
"--branch=stable", -- latest stable release
lazypath,
})
end
vim.opt.rtp:prepend(lazypath)
vim.g.mapleader = ' '
local function telescopeConfig()
local ts = require"telescope"
ts.setup({
defaults = {
-- layout_strategy = "vertical", -- better on vertical screens.
layout_config = { width = 0.93 }
},
extensions = {
file_browser = { hijack_netrw = true, }
},
media_files = {
-- -- defaults to {"png", "jpg", "mp4", "webm", "pdf"}
filetypes = {"png", "webp", "jpg", "jpeg", "mp4", "pdf", "webm"},
-- works with: foot, alacritty, rio
-- doesn't work with: ghostty, (probably kitty since it works similarly?)
-- find command (defaults to `fd`)
find_cmd = "rg"
}
-- other configuration values here
})
local tsb = require('telescope.builtin')
local k = vim.keymap
-- vim.g.mapleader = ' '
--- file browser shortcuts: https://github.com/nvim-telescope/telescope-file-browser.nvim#mappings
k.set("n", "<leader>dl", tsb.diagnostics, {desc="LSP: Telescope diagnostics"})
-- For some reason there is A being called after the below is run. Additionally
-- adding over one Esc keys aren't recognized. Might report as bug.
k.set("n", "<leader>vpv", "<cmd>Telescope keymaps<CR>>vp<Esc>");
k.set('n', '<leader><leader>', tsb.spell_suggest, {})
-- k.set('n', '<leader>3,', tsb.oldfiles, { desc="Telescope: old files" }) -- snacks
-- local a,b = pcall(function()
-- -- k.set('n', '<leader>,', ts.extensions.frecency.frecency, { desc="Telescope: frecency" })
-- k.del('n', '<leader>.')
-- k.set('n', '<leader>.', "<cmd>Telescope frecency<CR>", { desc="Telescope: frecency" })
-- end)
-- if not a then
-- vim.notify("Failed to load frecency keymap:\n"..tostring(b))
-- end
-- k.set('n', '<leader>b', tsb.buffers, { desc="Telescope: buffers" }) -- snacks
-- k.set('n', '<leader>f"', tsb.registers, { desc="Telescope: registers" }) -- snacks
k.set('n', '<leader>?', tsb.keymaps, { desc="Telescope: keymaps" }) -- snacks, but less verbose (at least out of the box)
-- k.set('n', '<leader>2fk', tsb.help_tags, -- snacks
-- { desc="Telescope: help tags (documentation)" })
k.set('n', '<leader>2<BS>', tsb.resume,
{desc="Telescope: use prev picker"})
-- error: k.set('n', '<leader>f/', builtin.grep_files, {})
-- k.set('n', '<leader>ff', builtin.find_files, {})
-- k.set('n', '<leader>ff', "<cmd>Telescope find_files hidden=true<CR>",
-- {desc="Telescope: find files"}) -- snacks does this
-- k.set('n', '<leader>fj',
-- '<cmd>Telescope find_files hidden=true search_dirs=$HOME/bk/<CR>',
-- {desc="Telescope: find backup files; keywords: >vpv joplin"})
-- k.set('n', '<leader>fc',
-- '<cmd>Telescope find_files hidden=true search_dirs=$HOME/p/learnxinyminutes-docs<CR>',
-- {desc="Telescope: offline code reference if learnxinyminutes-docs is git cloned in ~/p"})
k.set('n', '<leader>gz', function() vim.notify("Use `2gx`.") end)
k.set('n', '<leader>gj',
'<cmd>Telescope live_grep search_dirs=$HOME/bk*/<CR>',
{desc="Telescope: live grep (find text) in backup files; replacement to joplin. Requires rg."})
k.set('n', '<leader>2fm', "<cmd>Telescope man_pages<CR>", {})
k.set('n', '<leader>fv', tsb.git_files, {desc="Telescope: git files"})
k.set('n', '<leader>2fg', tsb.live_grep, {desc="Telescope: live grep"})
k.set('n', '<leader>2ft', "<cmd>TodoTelescope<CR>", {desc="Telescope: see tags from todo-comments.nvim"})
-- k.set('n', '<leader>f/', function() -- snacks
-- tsb.grep_string({ search = vim.fn.input("Grep > ") })
-- end, {desc="Telescope: Grep string"})
local function loadExtension(name, fn)
local success,msg = pcall(function()
ts.load_extension(name)
if fn then fn() end
end)
if not success then
vim.notify("Error loading telescope " .. name .. ": " .. msg)
end
end
loadExtension("file_browser", function()
k.set('n', '<leader>2fb',
"<cmd>Telescope file_browser<CR>", {desc="Telescope: file browser"})
end)
loadExtension("media_files", function()
k.set('n', '<leader>fp',
"<cmd>Telescope media_files<CR>", {desc = "Telescope: pictures; images; media files"})
end)
loadExtension("lazy", function()
k.set('n', '<leader>fl',
"<cmd>Telescope lazy<CR>", {desc = "Telescope: lazy plugin info"})
end)
-- require("telescope").load_extension("git_worktree")
loadExtension("git_worktree", function()
local gw = ts.extensions.git_worktree
k.set('n', '<leader>gwn', function()
gw.create_git_worktree()
end, {desc = "Telescope: git worktree: new"})
k.set('n', '<leader>gwv', function()
gw.git_worktrees()
end, {desc = "Telescope: git worktree: view"})
-- <Enter> - switches to that worktree
-- <c-d> - deletes that worktree
-- <c-f> - toggles forcing of the next deletion
-- Of course, also visible in <Esc>?
end)
loadExtension("ui-select")
-- loadExtension("frecency")
end
local function lspAndFoldConfig()
local a,b = pcall(function()
local path_mono_download = "$HOME/Apps/omnisharp-lsp-1.38.2/" -- not tested. may need to use /user/$HOME instead
-- local lspc = require('lspconfig') -- pre-v0.11.0
-- require('lspconfig/configs') -- this is deprecated too probably. or in lsp folder instead.
local capabilities = vim.lsp.protocol.make_client_capabilities()
capabilities.textDocument.completion.completionItem.snippetSupport = true
capabilities.textDocument.foldingRange = { -- from nvim-ufo docs
dynamicRegistration = false,
lineFoldingOnly = true
}
-- For easy starting point see `:help lspconfig-all` or https://github.com/neovim/nvim-lspconfig/blob/master/doc/configs.md
-- :help lspconfig-
local lspLs = {
-- TODO: Consider using 'emmylua_ls' ... it's around 3x lighter in RAM when starting up.. readme says 10x faster.. sounds believable.
{
'lua_ls',
{
-- There are no vim warnings everywhere with below code
-- This is one solution to vim warnings if below code doesn't work for you:
-- https://github.com/neovim/neovim/discussions/24119
-- This option performs better if you are able to set it up with this:
-- workspace.library is the bottle neck. I notice the speed improvement too. More info: https://luals.github.io/wiki/performance/
-- Also in general if..
-- - more than 1 lua-language-server runs in the background (there should only be one installed)
-- - OR restarting neovim quickly as of v0.11.3 (seems like neovim bug, previous lua_ls should be killed), which can lead to above.
-- ..there will be many global variable warnings in this file.
on_init = function(client)
local path = client.workspace_folders[1].name
-- vim.notify("lua_ls path: " .. vim.inspect(path)) -- emmylua_ls is better probably ..
local home = uv.os_homedir()
local uhohDir = path == home .. "/p" or path == home -- rootUri should be nil if these are root folders.
if uhohDir then
vim.notify(vim.inspect(client))
vim.notify("WARNING: Potential performance issue might occur. Remove .luarc.json from (" .. path .. ") bad folder and then run LSP again / restart nvim.")
client.rootUri = nil -- This doesn't seem to be working workaround. Follow notified instructions above.
end
if uv.fs_stat(path..'/.luarc.json') or uv.fs_stat(path..'/.luarc.jsonc') then
vim.notify(".luarc found. exiting.")
return
end
client.config.settings.Lua = vim.tbl_deep_extend('force', client.config.settings.Lua, {
workspace = {
checkThirdParty = true, -- diagnostics.globals is not working at the moment.
library = {
-- vim.env.VIMRUNTIME, -- nvim lua info shows up with this enabled
"/usr/share/nvim",
-- Depending on the usage, you might want to add additional paths here.
-- "${3rd}/luv/library"
-- "${3rd}/busted/library",
}
},
telemetry = { enable = false },
diagnostics = { globals = { 'Snacks', 'vim' } }, -- Remove global warnings for these variables. WARNING: This has stopped working recently.
runtime = { version = "LuaJIT" }
})
end,
settings = { Lua = {} }
},
},
--]]
{
-- omnisharp is 1.38.2 and many guides seems to fallback to that version. My guess: I think it doesn't work on the version of Unity I have to use.
-- https://dzfrias.dev/blog/neovim-unity-setup/
-- FIX: (possibly fixed as of 2024-9-12 check again)
-- So far doesn't work. Errors in unity. Will do more research
-- if I have time to prioritize this...
'omnisharp',
{
cmd = {
'mono',
'--assembly-loader=strict',
path_mono_download .. '/omnisharp/OmniSharp.exe',
},
-- Assuming you have an on_attach function. Delete this line if you don't.
-- on_attach = on_attach,
use_mono = true,
}
},
{ -- https://github.com/aca/emmet-ls#configuration
'emmet_ls', -- Installed from Mason
{
-- on_attach = on_attach,
capabilities = capabilities,
init_options = {
html = {
options = {
-- For possible options, see: https://github.com/emmetio/emmet/blob/master/src/config.ts#L79-L267
["bem.enabled"] = true,
},
},
}
}
},
'bashls', 'denols', 'pylsp', 'zls', 'tinymist',
'rust_analyzer', 'ts_ls', 'zk', 'gopls',
-- 'golangci_lint_ls', 'emmylua_ls', 'marksman' (even if marksman works, too much RAM in my opinion. There's a better way with enough time.)
}
for _,v in ipairs(lspLs) do
if type(v) ~= "table" then
vim.lsp.config(v, {capabilities = capabilities})
-- vim.lsp.enable(v) -- alternatively without "capabilities" (it's probably automatic)
-- lspc[v].setup { capabilities = capabilities } -- pre-0.11.0 ( :help lspconfig-nvim-0.11 )
else
-- vim.notify(vim.inspect(v))
-- lspc[v[1]].setup(v[2]) -- pre-0.11.0
vim.lsp.config(v[1], v[2])
end
end
end)
if not a then
print("failed to setup lspconfig: "..b)
end
a,b = pcall(function() -- for lsp-based folds)
vim.o.foldcolumn = '1' -- '0' is not bad
vim.o.foldlevel = 99 -- Using ufo provider need a large value, feel free to decrease the value
vim.o.foldlevelstart = 99
vim.o.foldenable = true
-- Using ufo provider need remap `zR` and `zM`. If Neovim is 0.6.1, remap yourself
vim.keymap.set('n', 'zR', require('ufo').openAllFolds)
vim.keymap.set('n', 'zM', require('ufo').closeAllFolds)
end)
if not a then
vim.notify("Error loading nvim-ufo sets: " .. b)
end
a,b = pcall(function() require('ufo').setup() end)
if not a then
vim.notify("Error loading nvim-ufo: " .. b)
end
end
-- Example: invisiBkgd("ron")
-- Example #2: invisiBkgd(nil, true)
-- Example #3: invisiBkgd("vim", true)
-- ^^ colorscheme=vim with typos underlined + invisible background.
local function invisiBkgd(color, isSpell, showBg) -- NOTE: ColorMyPencils() is a duplicate of this function but global. ../../after/plugin/colors.lua
local s = { bg = "none" }
local a,b = pcall(function()
if type(color) == "table" then
color = color.name -- automatically passed from Lazy
end
if color then
if color:lower():sub(1, 10) == "cyberdream" then -- fix for cyberdream when switching between light and dark theme
vim.cmd.CyberdreamToggleMode()
vim.cmd.CyberdreamToggleMode()
end
vim.cmd.colorscheme(color)
end
end)
if not a then
vim.notify("Could not apply colorscheme: "..tostring(b))
end
if not isSpell or type(isSpell) == "table" then -- empty table exists from Lazy
vim.cmd.hi("clear", "SpellBad") -- removes highlight since I set spell to true by default
vim.cmd.hi("clear", "SpellCap")
end
if not showBg then
vim.api.nvim_set_hl(0, "Normal", s)
vim.api.nvim_set_hl(0, "NormalFloat", s)
vim.api.nvim_set_hl(0, "TelescopeNormal", s)
vim.api.nvim_set_hl(0, "NormalNC", s)
if tostring(color) ~= "hyper" and a then
return
end
vim.notify("colorscheme switching is *not* supported after using hyper colorscheme. colorschemes may be broken.")
-- below 2 lines add extra white text, but makes background invisible in outline.nvim window
vim.api.nvim_set_hl(0, 'SpecialKey', s)
vim.api.nvim_set_hl(0, 'NonText', s)
vim.api.nvim_set_hl(0, 'EndOfBuffer', s)
vim.api.nvim_set_hl(0, 'TabLineFill', s)
vim.api.nvim_set_hl(0, 'TabLine', s)
vim.api.nvim_set_hl(0, 'TabLineSel', s)
vim.api.nvim_set_hl(0, 'LineNr', s)
vim.api.nvim_set_hl(0, 'SignColumn', s)
end
end
-- local function toggleZen(win) -- not working
-- local isZen = not not win:is_floating() -- not vim.wo.nu
local function toggleNotZen(isNotZen)
vim.wo.wrap = isNotZen
vim.wo.nu = isNotZen
vim.wo.rnu = isNotZen
vim.wo.colorcolumn = isNotZen and "80" or "0"
local a,b = pcall(function()
-- vim.cmd.GitGutterToggle()
if isNotZen then
vim.cmd.Gitsigns("attach")
else
vim.cmd.Gitsigns("detach")
end
end)
if not a then
vim.notify("Failed to toggle gitsigns.nvim: " .. tostring(b))
end
end
-- local sysn = uv.os_uname().sysname -- "Android" is "Linux" according to this. So that won't work here.
local sysn = vim.split(vim.api.nvim_exec2("!uname -o", { output = true }).output, "\n", {trimempty=true, plain=true}) or {"ErrorNoUname"}
sysn = tostring(sysn[#sysn])
local isAndroid = sysn == "Android"
-- local rainbow_delimiters
local plugins = {
{
"nvim-treesitter/nvim-treesitter",
event = "VeryLazy",
build = ":TSUpdate",
config = function()
require'nvim-treesitter.configs'.setup {
-- A list of parser names, (five required parsers should always be installed)
-- Below installs everything, unless it's on Android, due to a major issue.
ensure_installed = isAndroid and { "rust", "javascript", "python", "c", "lua", "vim", "query", "vimdoc" } or "all",
-- "vimdoc" might be "help" in <0.9.0 nvim.
-- Install parsers synchronously (only applied to `ensure_installed`)
sync_install = false,
-- Automatically install missing parsers when entering buffer
-- Recommendation: set to false if you don't have `tree-sitter` CLI installed locally
auto_install = false,
---- If you need to change the installation directory of the parsers (see -> Advanced Setup)
-- parser_install_dir = "/some/path/to/store/parsers", -- Remember to run vim.opt.runtimepath:append("/some/path/to/store/parsers")!
highlight = {
enable = true,
-- Setting this to true will run `:h syntax` and tree-sitter at the same time.
-- Set this to `true` if you depend on 'syntax' being enabled (like for indentation).
-- Using this option may slow down your editor, and you may see some duplicate highlights.
-- Instead of true it can also be a list of languages
additional_vim_regex_highlighting = {"lua"},
},
}
end,
--[[ commit that (in theory) supports nvim 0.8.0 - <0.9.1
commit = "2aa9e9b0e655462890c6d2d8632a0d569be66482",
-- [\#7272](https://github.com/nvim-treesitter/nvim-treesitter/pull/7272) raises minimum Neovim version >= v0.10.0. Need to stay on Nvim 0.9.2? Lock nvim-treesitter to v0.9.3.
--]]
},
-- LSP Support
{ 'williamboman/mason.nvim', event = "VeryLazy"},-- Optional
{ 'williamboman/mason-lspconfig.nvim', -- b950110 fix: update required nvim version to >= 0.9.0 (#478) (2024-10-22) -- do i need this if i use vim.lsp?
dependencies = { 'williamboman/mason.nvim' },
event = "VeryLazy",
config = function()
require("mason").setup()
-- ensure_installed sometimes launches an extra "lua_ls", causing warnings that the LSP should be ignoring. Additionally for Termux, *ensure_installed* doesn't work at the moment. Manually install with Mason package manager instead.
require("mason-lspconfig").setup()
-- .setup { ensure_installed = { "lua_ls", "rust_analyzer", },
end
}, -- Optional
{ 'neovim/nvim-lspconfig', event = "VeryLazy", config = lspAndFoldConfig }, -- Required
-- Autocompletion (taken with minimal changes from https://github.com/cpow/neovim-for-newbs/blob/7cee93b394359c2fee4f134d27903af65742247d/lua/plugins/completions.lua )
{
"hrsh7th/cmp-nvim-lsp"
},
{
"L3MON4D3/LuaSnip",
event = "VeryLazy",
dependencies = {
"saadparwaiz1/cmp_luasnip",
"rafamadriz/friendly-snippets",
},
},
{
"hrsh7th/nvim-cmp",
event = "VeryLazy",
config = function()
local cmp = require("cmp")
require("luasnip.loaders.from_vscode").lazy_load()
cmp.setup({
snippet = {
expand = function(args)
require("luasnip").lsp_expand(args.body)
end,
},
-- window = {
-- completion = cmp.config.window.bordered(),
-- documentation = cmp.config.window.bordered(),
-- },
mapping = cmp.mapping.preset.insert({
["<C-b>"] = cmp.mapping.scroll_docs(-4),
["<C-f>"] = cmp.mapping.scroll_docs(4),
["<C-Space>"] = cmp.mapping.complete(),
-- ["<C-e>"] = cmp.mapping.abort(), -- Not recommended in Termux (this appears to no longer be an issue so far)
["<C-y>"] = cmp.mapping.confirm({ select = true }), -- BUG: Since some time, this will once in a while go back to <CR> for an unknown reason. (Uncommenting and commenting this line possibly fixed this for me temporarily).
}),
sources = cmp.config.sources({
-- { name = "crates" }, -- rust crates.nvim -- the autocmd below does lazyloading which this line doesn't do.
-- { name = "codeium" }, -- AI cmp. Should be easier to toggle for what file exists.
{ name = "nvim_lsp" },
{ name = "luasnip" }, -- For luasnip users.
{ name = "nvim_lua" },
}, {
{ name = "buffer" },
}),
})
vim.api.nvim_create_autocmd("BufRead", {
group = vim.api.nvim_create_augroup("CmpSourceCargo", { clear = true }),
pattern = "Cargo.toml",
callback = function()
cmp.setup.buffer({ sources = { { name = "crates" } } }) -- alternative cmp lazyloading way according to https://github.com/Saecki/crates.nvim/wiki/Documentation-v0.4.0
end,
})
-- vim.api.nvim_create_autocmd("BufRead", {
-- group = vim.api.nvim_create_augroup("CmpSourceCodeium", { clear = true }),
-- pattern = "*.lua",
-- callback = function()
-- cmp.setup.buffer({ sources = { { name = "codeium" } } })
-- end,
-- })
end,
},
{
"kevinhwang91/nvim-ufo",
dependencies = { "kevinhwang91/promise-async" },
},
-- uses ys; which stands for you surround; very powerful and must have if
-- you know how to use it; see `:h nvim-surround.usage` for more info
{
"kylechui/nvim-surround",
version = "*", -- Use for stability; omit to use `main` branch for the latest features
event = "VeryLazy",
config = true,
},
{
'nvim-telescope/telescope.nvim',
-- tag = '0.1.4', -- tested to not break in Termux (0.1.5 breaks Termux)
-- tag = '0.1.6', -- newest as of 2024 Apr 27.
tag = '0.1.8', -- newest as of 2024 Dec 22
-- or , branch = '0.1.x',
dependencies = { 'nvim-lua/plenary.nvim' },
event = "VeryLazy",
config = telescopeConfig,
},
{
'nvim-telescope/telescope-media-files.nvim',
dependencies = { 'nvim-lua/popup.nvim', 'nvim-telescope/telescope.nvim' },
event = "VeryLazy",
},
{ 'nvim-telescope/telescope-ui-select.nvim', event = "VeryLazy", },
{ -- useful keybinds: https://github.com/nvim-telescope/telescope-file-browser.nvim#mappings
"nvim-telescope/telescope-file-browser.nvim",
event = "VeryLazy",
dependencies = { "nvim-telescope/telescope.nvim", "nvim-lua/plenary.nvim" }
},
{ 'tsakirist/telescope-lazy.nvim', event = "VeryLazy" },
{
"nvim-tree/nvim-tree.lua",
version = "*",
-- lazy = false,
keys = {
{
"<leader>ls",
function() require("nvim-tree.api").tree.toggle({focus=false}) end,
desc = "Toggle nvim tree",
mode = "n",
},
},
dependencies = {
"nvim-tree/nvim-web-devicons",
},
config = {
view = {
number = true,
relativenumber = true,
}
}
},
{ 'TarunDaCoder/sus.nvim', event = "VeryLazy", config = true },
{ 'nmac427/guess-indent.nvim', event = "VeryLazy", config = true },
{
"nomnivore/ollama.nvim",
dependencies = {
"nvim-lua/plenary.nvim",
},
cmd = { "Ollama", "OllamaModel", "OllamaServe", "OllamaServeStop" },
keys = {
-- Sample keybind for prompt menu. Note that the <c-u> is important for selections to work properly.
{
"<leader>aio",
":<c-u>lua require('ollama').prompt()<cr>",
desc = "ollama: prompt",
mode = { "n", "v" },
},
-- Sample keybind for direct prompting. Note that the <c-u> is important for selections to work properly.
{
"<leader>aiG",
":<c-u>lua require('ollama').prompt('Generate_Code')<cr>",
desc = "ollama: Generate Code",
mode = { "n", "v" },
},
{
"<leader>ai",
":Telescope keymaps<CR>>ai",
desc = "Show AI keymaps",
mode = { "n", "v" }
}
},
config = true
},
{
"pwntester/octo.nvim", -- tags: github gh
cmd = "Octo",
dependencies = {
'nvim-lua/plenary.nvim',
'nvim-telescope/telescope.nvim', -- or ibhagwan/fzf-lua
'nvim-tree/nvim-web-devicons'
},
config = true
},
{ -- this takes a couple MB ... might not be best idea if you're low on space. BUG: nvim cannot be used while process has started with this plugin.
"chrishrb/gx.nvim",
-- it conflicts once in a while but usually saves time
keys = { { "2gx", "<cmd>Browse<cr>", mode = { "n", "x" }} },
cmd = { "Browse" },
init = function()
-- vim.g.netrw_nogx = 1 -- disable netrw gx
end,
dependencies = { "nvim-lua/plenary.nvim" },
-- config = true, -- default settings
-- you can specify also another config if you want
opts = {
-- open_browser_app = "os_specific",
-- -- below is an example if you want to use handlr instead of xdg-open
-- open_browser_app = "handlr", -- specify your browser app; default for macOS is "open", Linux "xdg-open" and Windows "powershell.exe"
-- open_browser_args = { "open" }, -- specify any arguments, such as --background for macOS' "open".
handlers = {
plugin = true,
github = true,
brewfile = false, -- Homebrew
package_json = true,
search = false, -- search the web if nothing else is found
},
handler_options = {
search_engine = "duckduckgo", -- select between google, bing, duckduckgo, and ecosia
-- search_engine = "https://search.brave.com/search?q=", -- or custom search engine
},
},
},
{ -- WARNING: minimum version 0.10.0 according to GitHub (based on my testing, 0.9.0 - 0.9.5 seem to work perfectly fine.)
"NStefan002/screenkey.nvim",
-- lazy = false,
cmd = "Screenkey",
version = "*", -- or branch = "dev", to use the latest commit
},
{ 'saecki/crates.nvim', ft = "toml", tag = 'stable', config = true },
-- visualize jump to character
{
'jinh0/eyeliner.nvim',
event = "VeryLazy",
opts = {
highlight_on_key = true,
-- dim = false
}
},
{ -- :DataView
'vidocqh/data-viewer.nvim',
-- opts = { autoDisplayWhenOpenFile = true, view = { float = false } },
opts = { autoDisplayWhenOpenFile = true },
event = "VeryLazy",
dependencies = {
"nvim-lua/plenary.nvim",
-- "kkharji/sqlite.lua", -- Optional, sqlite support
},
-- ft = {"csv", "tsv", "sqlite"} -- This breaks autodisplay config
},
{
'cameron-wags/rainbow_csv.nvim',
config = true,
ft = {
'csv',
'tsv',
'csv_semicolon',
'csv_whitespace',
'csv_pipe',
'rfc_csv',
'rfc_semicolon'
},
cmd = {
'RainbowDelim',
'RainbowDelimSimple',
'RainbowDelimQuoted',
'RainbowMultiDelim'
}
},
--[[ { -- this does take 7MB space btw.. -- NOTE: "local rainbow_delimiters" exists
"HiPhish/rainbow-delimiters.nvim",
-- event = "VeryLazy",
keys = {
{ "<leader>hr",
function()
if rainbow_delimiters then
rainbow_delimiters.toggle() -- this should've been in README/docs.
return
end
rainbow_delimiters = require'rainbow-delimiters'
vim.g.rainbow_delimiters = {
strategy = {
[''] = rainbow_delimiters.strategy['global'],
vim = rainbow_delimiters.strategy['local'],
},
query = { [''] = 'rainbow-delimiters', lua = 'rainbow-blocks', },
priority = { [''] = 110, lua = 210, },
highlight = {
'RainbowDelimiterRed',
'RainbowDelimiterYellow',
'RainbowDelimiterBlue',
'RainbowDelimiterOrange',
'RainbowDelimiterGreen',
'RainbowDelimiterViolet',
'RainbowDelimiterCyan',
},
}
rainbow_delimiters.enable()
end, mode = "n",
desc = 'Toggle rainbow delimiters. This may be sluggish in big files, when using animations, or changing the "strategy" config.'
},
},
},
--]]
-- markdown alternative to below: github.com/2kabhishek/tdo.nvim (may use this)
{"iamcco/markdown-preview.nvim",
ft = "markdown",
build = "cd app && yarn install", -- NOTE: If lazy asks to remove and install while going from npm to yarn, do that and it should be fixed.
-- build = "cd app && npm install", -- If using npm
config = function() vim.g.mkdp_filetypes = { "markdown" } end,
},
{ -- headlines.nvim but way better
"MeanderingProgrammer/render-markdown.nvim",
ft = "markdown", -- :RenderMarkdown
config = function()
require("render-markdown").setup({
link = {
custom = {
youtube2 = { pattern = 'youtu%.be', icon = ' ' },
twitter = { pattern = 'xcancel%.com', icon = ' '},
twitter2 = { pattern = 'twitter%.com', icon = ' '},
-- twitter3 = { pattern = 'x%.com', icon = '𝕏 '}, -- WARNING: this will match any domain that ends with "x.com" for example "roblox.com" or "xbox.com"
arch = { pattern = 'archlinux%.org', icon = ' '},
wikipedia = { pattern = 'wikipedia%.org', icon = ' '},
google = { pattern = 'google%.com', icon = ' '},
apple = { pattern = 'apple%.com', icon = ' '},
mozilla = { pattern = 'mozilla%.org', icon = ' '},
trello = { pattern = 'trello%.com', icon = ' '},
discord = { pattern = 'discord%.gg', icon = ' '},
godot = { pattern = 'godotengine%.org', icon = ' '},
itch = { pattern = 'itch%.io', icon = ' '},
github2 = { pattern = 'githubusercontent%.com', icon = ' '},
kofi = { pattern = 'kofi%.com', icon = ' '},
patreon = { pattern = 'patreon%.com', icon = ' '},
liberap = { pattern = 'liberapay%.com', icon = ' '},
}
},
})
end
},
{ "dhruvasagar/vim-table-mode", cmd = "TableModeToggle",
-- ft = "markdown" PERF:
},
-- PERF ("perfect".. no need for improvement), HACK, TODO, NOTE, FIX, WARNING
{ "folke/todo-comments.nvim", config = true, event = "VeryLazy", },
-- -- in theory, works with .puml files and probably other UML files:
-- 'https://gitlab.com/itaranto/preview.nvim', version = '*', config = true
{ 'nacro90/numb.nvim', event = "VeryLazy", config = true }, -- non-intrusively preview while typing :432...
--- Colorschemes below. if you just uncomment and comment a plugin below, it will be the default. Personally, I don't want to load all the themes.
{ 'dasupradyumna/midnight.nvim', name = "midnight",
lazy = true },
{ 'rose-pine/neovim', name = 'rose-pine',
config = invisiBkgd, }, -- init = invisiBkgd },
{ 'rebelot/kanagawa.nvim', name = 'kanagawa',
lazy = true },
{ 'AlexvZyl/nordic.nvim', name = 'nordic',
lazy = true }, -- swap this line with "config = ..." to set as default theme
{ 'scottmckendry/cyberdream.nvim', name = 'cyberdream',
lazy = true },
{ -- WARNING: Might remove later if there's a quicker alternative that has the same basic functionality.
'nvim-lualine/lualine.nvim',
dependencies = { 'nvim-tree/nvim-web-devicons', lazy = true },
config = true
},
{ -- Makes tabs more configurable + friendly.
-- `:help tabby.txt` `:Tabby`
'nanozuki/tabby.nvim',
event = "VeryLazy",
dependencies = 'nvim-tree/nvim-web-devicons',
-- config = true,
config = function()
local theme = {
fill = 'TabLineFill',
-- Also you can do this: fill = { fg='#f2e9de', bg='#907aa9', style='italic' },
head = 'TabLine',
current_tab = 'TabLineSel',
tab = 'TabLine',
win = 'TabLine',
tail = 'TabLine',
-- WARNING: This is what WON'T work:
-- fill = { fg='#f2e9de', bg='none', style='italic' }, -- bg='Clear' errors (that what I do w/ my own script.)
-- head = { fg='#00ffde', bg='none', style='italic' },
-- current_tab = { fg='#00ffde', bg='none', style='italic' },
-- tab = { fg='#000000', bg='none', style='italic' },
-- win = { fg='#000000', bg='none', style='italic' },
-- tail = { fg='#000000', bg='none', style='italic' },
}
require('tabby').setup({
line = function(line) -- src: `:help tabby-setup-setup-tabby.nvim`
return { -- this makes tab line cleaner + no unneeded buftab
-- ' ',
' ',
line.tabs().foreach(function(tab)
local hl = tab.is_current() and theme.current_tab or theme.tab
return {
line.sep('', hl, theme.fill),
tab.is_current() and '' or '',
tab.number(),
tab.name(),
tab.close_btn(''),
line.sep('', hl, theme.fill),
hl = hl,
margin = ' ',
}
end),
hl = theme.fill,
}
end,
-- option = {}, -- setup modules' option,
})
end,
keys = {
{ "<leader>gtr", ":Tabby rename_tab ", mode = "n", desc = "Rename tab"},
},
},
{ -- WARNING: See below instructions for live server to work.
'barrett-ruth/live-server.nvim',
event = "VeryLazy",
--[[ if switching from npm you can uninstall by (might need sudo):
npm uninstall -g live-server
yarn global add @compodoc/live-server # less security issues with this live-server command
-- If it doesn't work after everything above has been done, try reinstalling this plugin. Then it should work.
--]]
-- alternative which probably isn't compatible: five-server
-- build = 'npm install -g live-server', -- If using npm
build = 'yarn global add @compodoc/live-server', -- in theory this is needed after installing this plugin. Couldn't test it right now.
cmd = "LiveServerToggle", -- This is now built-in :)
keys = {
{
"<leader>ll",
-- vim.cmd.LiveServerToggle, -- not found
":LiveServerToggle<CR>",
desc = "Toggle live server",
mode = "n",
},
},
config = true,
},
{ -- Con: Appears to not usually work when multiple file are involved. Pro: Doesn't error like that other plugin..
"aliqyan-21/runTA.nvim",
cmd = "RunCode",
config = function()
require("runTA.commands").setup(
{output_window_configs={transparent=true}})
end,
},
--[[ Below has some more advanced features and supports different
languages. It errors on neovim startup sometimes leading to a broken
plugin, and is not as minimal, so I use above instead.
github.com/Zeioth/compiler.nvim
--]]
{
"davisdude/vim-love-docs",
event = "VeryLazy",
pin = true, -- there are errors on update, so this will stop updates.
-- This plugin doesn't work out of the box.
--[[ Extra steps to make this work:
1. Get the dependencies.
The built-in luaJIT from Neovim doesn't work don't do this:
- ~/.local/share/nvim/lazy/vim-love-docs/src/env.txt
`lua="lua"` to `lua="nvim -l"`
2. Download file from instructions:
https://github.com/davisdude/vim-love-docs/tree/master
Place it in:
~/.local/share/nvim/lazy/vim-love-docs/src
3. Run the file. There should be no errors.
]]
--
},
-- not working for some reason 'm4xshen/autoclose.nvim',
{
"windwp/nvim-autopairs",
event = "InsertEnter",
config = function()
local p = require("nvim-autopairs")
p.setup { check_ts = true }
p.remove_rule('`')
end
},
{
-- auto-session alternative with more lua and telescope integration
'jedrzejboczar/possession.nvim',
dependencies = { 'nvim-lua/plenary.nvim', 'nvim-telescope/telescope.nvim' },
config = true,
cmd = { "PossessionLoad", "PossessionDelete", "PossessionSave" },
keys = {
{ "<leader>sf", function()
pcall(function()
vim.cmd("wa | PossessionSave! tempauto")
-- local tmp2 = vim.fn.stdpath("data") .. "/possession/tempauto.json"
-- local str = "PossessionDelete!" -- the ! causes an error for some reason
-- vim.cmd("!(killall lua-language-server;$TERMINAL -e \"$(which nvim)\" +'sleep 20m | lua vim.cmd(\"PossessionLoad tempauto\"); vim.cmd(\"" .. str .. "tempauto\")' 2> /dev/null &);sleep 0.01")
vim.cmd("!(killall lua-language-server 2> /dev/null; $TERMINAL -e \"$(which nvim)\" +'sleep 20m | PossessionLoad tempauto' 2> /dev/null &);sleep 0.01")
end)
vim.notify('WARNING: this is lingering old session')
vim.cmd("qa")
end, mode = "n", desc="possession: restart nvim and restore changes"},
{ "<leader>se", "<cmd>PossessionLoad temp<CR>", mode = "n", desc="possession: load temp session"},
{ "<leader>sw", "<cmd>wa | PossessionSave! temp<CR>", mode = "n", desc="possession: write files and save temp session"},
{ "<leader>sx", "<Esc><cmd>wa | PossessionSave! temp<CR><cmd>qa<CR>", mode = "n", desc="possession: write files, save temp session and quit"},
{ "<leader>ss", ":PossessionSave ", mode = "n", desc="possession: save a file"},
{ "<leader>sl", ":PossessionLoad ", mode = "n", desc="possession: load a file"},
{ "<leader>sd", ":PossessionDelete ", mode = "n", desc="possession: delete a file"},
{ "<leader>fs", "<cmd>Telescope possession list<CR>", mode = "n", desc="possession: find session"},
{ "<leader>vd",":PossessionLoad daily<c-z><CR>", mode = "n", desc="possession: load 'daily*' (view daily) tag: >vp"},
},
},
-- { -- snacks does this
-- 'mbbill/undotree',
-- cmd = "UndotreeToggle",
-- keys = {
-- { "<leader>2u", vim.cmd.UndotreeToggle, mode = "n" }
-- }
-- },
{
"NeogitOrg/neogit", -- new plugin here. Possible addition/alternative to vim-fugitive. Seems promising (neogit is keyboard shortcut based vs vim fugitive improving git command line)
cmd = "Neogit",
dependencies = {
"nvim-lua/plenary.nvim", -- required
"sindrets/diffview.nvim", -- optional - Diff integration
-- Only one of these is needed.
"nvim-telescope/telescope.nvim", -- optional
-- "ibhagwan/fzf-lua", -- optional
-- "echasnovski/mini.pick", -- optional
},
keys = {
{ "<leader>2gs", function() vim.cmd("Neogit kind=vsplit") end, mode = "n", desc = "Open Neogit in vsplit"},
{ "<leader>gl", function() vim.cmd("NeogitLogCurrent .") end, mode = "n", desc = "Open Neogit in new tab (default)"},
},
},
{
'tpope/vim-fugitive',
-- event = "VeryLazy",
cmd = "Git",
keys = {
{ "<leader>gs", vim.cmd.Git, mode = "n", desc = "Open Git Fugitive"},
},
},
{'lewis6991/gitsigns.nvim', event = 'VeryLazy', -- requires v0.10+ unless you pin commit below
-- commit = "3c76f7f", -- ci!: target Nvim 0.11, drop testing for 0.9.5 (2025 Mar 30)
-- config = true, -- use default config
opts = { -- :help gitsigns-usage
signs = { add = { text = '+' }, },
signs_staged = { add = { text = '+' }, },
numhl = true, -- `:Gitsigns toggle_numhl`
word_diff = true, -- `:Gitsigns toggle_word_diff`
current_line_blame = true, -- `:Gitsigns toggle_word_diff`
current_line_blame_opts = {
delay = 200, -- default: 1000
}
},
keys = {
{ "<leader>ghv", ":Gits preview_hunk<CR>", mode = {"n", "v"}, desc = "Git Hunk: View"},
{ "<leader>ghs", ":Gits stage_hunk<CR>", mode = {"n", "v"}, desc = "Git Hunk: Stage"},
{ "<leader>ghu", ":Gits undo_stage_hunk<CR>",mode = {"n", "v"}, desc = "Git Hunk: Reset"},
{ "<leader>ghr", ":Gits reset_hunk<CR>", mode = {"n", "v"}, desc = "Git Hunk: Stage"},
{ "<leader>ghe", ":Gits select_hunk<CR>", mode = {"n", "v"}, desc = "Git Hunk: Edit (Ex: Select visual mode)"},
{ "<leader>ghn", ":Gits next_hunk<CR>", mode = {"n", "v"}, desc = "Git Hunk: Jump next"},
{ "<leader>ghp", ":Gits prev_hunk<CR>", mode = {"n", "v"}, desc = "Git Hunk: Jump prev"},
{ "<leader>gd", ":Gits diffthis<CR>", mode = {"n", "v"}, desc = "Git Diff" },
{ "<leader>hgh", ":Gits toggle_numhl<CR>:Gits toggle_word_diff<CR>",mode="n", desc = "Hide/toggle git highlighting" },
{ "<leader>hb", ":Gits toggle_current_line_blame<CR>",mode="n", desc = "Hide/toggle git blame (gitsigns.nvim) (normal)" },
{ "<leader>hb",":Gits toggle_current_line_blame<CR>gv",mode="v", desc = "Hide/toggle git blame (gitsigns.nvim) (visual)" },
}
-- commit = "76927d14d3fbd4ba06ccb5246e79d93b5442c188", -- v0.8 support
},
{
"2kabhishek/co-author.nvim",
commit = "e6458cb9d42266336a92e750c9452ac12ee03079",
cmd = "CoAuthor",
keys = { -- this is the whole plugin btw just the below feature
{ "<leader>gC", vim.cmd.CoAuthor, desc = "Quickly add co-authors to git commits", mode = "n" }
},
},
-- piersolenski/telescope-import.nvim Autofill imports. Supports JS; lua; py; c++.
{
"ThePrimeagen/git-worktree.nvim",
event = "VeryLazy",
-- config = function()
-- require("telescope").load_extension("git_worktree")
-- end
},
{'nvim-treesitter/nvim-treesitter-textobjects',
dependencies = { 'nvim-treesitter/nvim-treesitter' },
event = "VeryLazy",
config = function()
-- extremely basic setup is useful; has a ton of potential.
-- see https://github.com/nvim-treesitter/nvim-treesitter-textobjects#text-objects-move
require'nvim-treesitter.configs'.setup {
textobjects = {
select = {
enable = true,
-- Automatically jump forward to textobj, similar to targets.vim
lookahead = true,
keymaps = {
-- You can use the capture groups defined in textobjects.scm
["af"] = "@function.outer", ["if"] = "@function.inner",
["ac"] = "@class.outer", ["ic"] = "@class.inner",
["ib"] = "@block.inner", ["ab"] = "@block.outer",
-- I replaced default s with a, since I do use "sentence" in vim