-
Notifications
You must be signed in to change notification settings - Fork 2
/
init.lua
709 lines (610 loc) · 16.9 KB
/
init.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
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
--[[ Inspiration
-- https://github.com/rockerBOO/awesome-neovim
-- https://github.com/NTBBloodbath/doom-nvim/blob/main/docs/modules.md#list-of-modules
-- https://github.com/siduck76/NvChad theme
-- https://bluz71.github.io/2021/09/10/vim-tips-revisited.html
--]]
--[[ TODO
-- TODO: Change LSPInstall to https://github.com/williamboman/nvim-lsp-installer
-- https://github.com/williamboman/nvim-lsp-installer/issues/177
-- TODO: find another floaterm (toggleterm) plugin, make sure it autoresizes
-- TODO: gradle plugin
-- Update lsp config for installation
-- Use eslint LSP instead of eslint_d
-- and use https://github.com/mjlbach/neovim/blob/master/runtime/lua/vim/lsp/buf.lua#L187-L229?
-- Try https://github.com/b3nj5m1n/kommentary?
-- Telescope setup, find_files wrapper if buffer is directory
-- Set up linter? (efm, ale, nvim-lint, coc?)
-- https://github.com/mattn/efm-langserver#configuration-for-neovim-builtin-lsp-with-nvim-lspconfig
-- Set up snippets (custom and emmet)
-- Automatic lspinstall and treesitter parsers
-- Add auto packer clean, install, compile under autoinstall packer
-- Focus.nvim (https://github.com/beauwilliams/focus.nvim)
-- Merge conflict resolver (like vscode)
-- Cursor hover lsp hover or line diagnostic?
-- nvim cmp dadbod source
-- nvim cmp tzachar/cmp-fzy-buffer?
-- Telescope colorscheme preview
-- Plugin and config split into separate modules
-- TODO list (put on dashboard) - neorg vs vimwiki?
-- gitsigns hunk preview
--]]
--[[ Features/plugins
-- Coverage
-- Faded unused variables/imports?
-- Lazy loading
-- Gradual undo
-- Autosave and swapfiles?
-- Emmet / autoclose HTML
-- Markdown HTML Treesitter highlighting + Autotag support
-- Set up quick compiler
-- Code runner (Codi, https://github.com/dccsillag/magma-nvim)
-- https://github.com/ThePrimeagen/refactoring.nvim
-- Markdown preview - ellisonleao/glow.nvim, iamcco/markdown-preview.nvim
-- Markdown continue list on next line
-- Text object for separate parts of variable name, e.g. helloGoodbye, hello_goodbye
-- Telescope-cheat.nvim
-- mrjones2014/dash.nvim for linux?
-- https://github.com/zim0369/butcher string to array
-- https://github.com/ripxorip/aerojump.nvim
-- orgmode.nvim
-- bufferline.nvim or cokeline.nvim instead of barbar?
-- windline instead of galaxyline (deprecated)
-- nvimtree config migration
--]]
--[[ Notes
-- Galaxyline gap background not transparent
-- use null-ls as formatter? (has builtins and integrates with lsp)
-- nvim-cmp treesitter completion source vs buffer source?
-- Opening buffer for file (nvim-tree) replaces barbar buffers
--]]
-- https://github.com/wbthomason/packer.nvim --
-- Autoinstall packer
local packer_path = vim.fn.stdpath("data") .. "/site/pack/packer/start/packer.nvim"
if vim.fn.empty(vim.fn.glob(packer_path)) > 0 then
vim.api.nvim_command("!git clone https://github.com/wbthomason/packer.nvim " .. packer_path)
end
-- Automatically PackerCompile with changes
vim.cmd([[ autocmd BufWritePost plugins/init.lua source <afile> | PackerCompile ]])
return require("packer").startup(function(use)
---------------------
-- Setup Utilities --
---------------------
-- Packer can manage itself
use("wbthomason/packer.nvim")
-- Filetype config (faster startup and custom overrides)
use({
"nathom/filetype.nvim",
config = function()
-- NOTE: needed for versions prior to Neovim-0.6
vim.g.did_load_filetypes = 1
end,
})
-----------------------
-- General Utilities --
-----------------------
-- Fuzzy finder
use({
"nvim-telescope/telescope.nvim",
requires = {
{ "nvim-lua/plenary.nvim" },
{ "nvim-telescope/telescope-fzf-native.nvim", run = "make" },
{ "nvim-telescope/telescope-dap.nvim" },
{ "nvim-telescope/telescope-media-files.nvim" },
-- { "nvim-telescope/telescope-node-modules.nvim" },
},
after = "nvim-neoclip.lua",
config = require("plugins.telescope").setup,
})
-- Search for TODO comments and Trouble pretty list
use({
"folke/todo-comments.nvim",
requires = { "nvim-lua/plenary.nvim", "folke/trouble.nvim" },
config = require("plugins.notes"),
})
-- Keybinds
use({
"folke/which-key.nvim",
config = require("plugins.binds").which_key,
})
-- Extra mappings (with encoding/decoding as well)
use("tpope/vim-unimpaired")
-- "." repeat for some commands
use("tpope/vim-repeat")
-- Statusline
use({
"glepnir/galaxyline.nvim",
branch = "main",
requires = "kyazdani42/nvim-web-devicons",
after = "onedark.nvim",
config = require("plugins.galaxyline"),
})
-- Tabline
-- TODO: check out https://github.com/akinsho/nvim-bufferline.lua
use({
"romgrk/barbar.nvim",
disable = false,
requires = "kyazdani42/nvim-web-devicons",
config = require("plugins.barbar"),
})
use({
"akinsho/bufferline.nvim",
disable = true,
requires = "kyazdani42/nvim-web-devicons",
config = function()
require("bufferline").setup({})
end,
})
-- Floating terminal
use({
"voldikss/vim-floaterm",
config = require("plugins.floaterm"),
})
-- Startup screen
-- TODO: see if this integrates https://github.com/rmagatti/auto-session
use({
"glepnir/dashboard-nvim",
config = require("plugins.dashboard"),
})
-- Zen mode
use({
"folke/zen-mode.nvim",
requires = "folke/twilight.nvim",
config = require("plugins.zen"),
})
-- Minimap
-- INSTALL: yay -S code-minimap
use("wfxr/minimap.vim")
-- Undo history
use({
"mbbill/undotree",
config = require("plugins.undo"),
})
-- Clipboard manager
use({
"AckslD/nvim-neoclip.lua",
requires = { "tami5/sqlite.lua", module = "sqlite" },
config = function()
require("neoclip").setup({
enable_persistant_history = true,
})
end,
})
-- Notification
use({
"rcarriga/nvim-notify",
config = function()
require("notify").setup({
background_colour = "#000000",
render = "minimal",
on_open = function(win)
-- transparent background
-- vim.api.nvim_win_set_option(win, "winblend", 25)
-- vim.api.nvim_win_set_config(win, { zindex = 100 })
end,
})
end,
})
-- Better quickfix list
use({
"kevinhwang91/nvim-bqf",
ft = "qf",
})
-- Stabilise buffers
use({
"luukvbaal/stabilize.nvim",
config = function()
require("stabilize").setup({
-- for stabilising quickfix list (trouble.nvim)
nested = "QuickFixCmdPost,User LspDiagnosticsChanged",
})
end,
})
-- Open with sudo
-- use("tpope/vim-eunuch")
use("lambdalisue/suda.vim")
-- Remote ssh
-- Without remote distant server: :DistantLaunch server mode=ssh ssh.user=<username>
use({
"chipsenkbeil/distant.nvim",
config = function()
require("distant").setup({
-- Applies Chip's personal settings to every machine you connect to
--
-- 1. Ensures that distant servers terminate with no connections
-- 2. Provides navigation bindings for remote directories
-- 3. Provides keybinding to jump into a remote file's parent directory
["*"] = require("distant.settings").chip_default(),
})
end,
})
-------------------
-- File Explorer --
-------------------
-- Tree file explorer
use({
"kyazdani42/nvim-tree.lua",
requires = "kyazdani42/nvim-web-devicons",
config = require("plugins.nvimtree"),
})
-- nnn file explorer
use({
"luukvbaal/nnn.nvim",
config = function()
require("nnn").setup({
explorer = {
side = "botright",
},
})
end,
})
------------------
-- Helper Tools --
------------------
-- Text abbreviation / substitution / coercion
use("tpope/vim-abolish")
-- Case conversion
use({
"arthurxavierx/vim-caser",
config = function()
-- Works with motions, text objects and visual mode as well
vim.g.caser_prefix = "cR"
end,
})
-- Unit converter
use("simonefranza/nvim-conv")
-- Incrementor / decrementor
use("monaqa/dial.nvim")
------------------
-- UI Utilities --
------------------
-- Bracket coloured pairs
-- TODO: change colourscheme, esp red
use({
"p00f/nvim-ts-rainbow",
requires = "nvim-treesitter/nvim-treesitter",
config = function()
require("nvim-treesitter.configs").setup({
rainbow = {
enable = true,
extended_mode = true, -- Also highlight non-bracket delimiters like html tags
max_file_lines = 1000,
},
})
end,
})
-- Indent context indicator
use({
"lukas-reineke/indent-blankline.nvim",
requires = "nvim-treesitter/nvim-treesitter",
config = require("plugins.indentline"),
})
-- Scope context indicator
use({
"code-biscuits/nvim-biscuits",
requires = "nvim-treesitter/nvim-treesitter",
config = require("plugins.biscuits"),
})
-- Mark indicator
use({
"chentau/marks.nvim",
config = function()
-- m[ and m] to navigate marks
require("marks").setup({})
end,
})
-- Underline word under cursor
use({
"osyo-manga/vim-brightest",
config = function()
-- Highlight group (e.g. BrighestUndercurl)
vim.g["brightest#highlight"] = { group = "BrightestUnderline" }
end,
})
-- CSS colours
-- NOTE: doesn't highlight lower case names
use({
"norcalli/nvim-colorizer.lua",
config = function()
require("colorizer").setup()
end,
})
-- Search highlights
use("romainl/vim-cool")
-- Substitution preview
use("markonm/traces.vim")
-- Smooth scroll
-- TODO: configure animation duration
use({
"karb94/neoscroll.nvim",
disable = true,
config = function()
require("neoscroll").setup()
end,
})
-------------
-- Theming --
-------------
-- https://github.com/ful1e5/onedark.nvim ?
use({
"navarasu/onedark.nvim",
config = function()
vim.g.onedark_transparent_background = true
require("onedark").setup()
end,
})
use({
"folke/tokyonight.nvim",
config = function()
vim.g.tokyonight_transparent = true
vim.g.tokyonight_transparent_sidebar = true
end,
})
use({
"Mofiqul/dracula.nvim",
config = function()
vim.g.dracula_transparent_bg = true
end,
})
use({
"EdenEast/nightfox.nvim",
config = function()
local nightfox = require("nightfox")
nightfox.setup({
fox = "duskfox",
transparent = true,
alt_nc = true,
})
-- nightfox.load()
end,
})
use({
"bluz71/vim-nightfly-guicolors",
config = function()
-- TODO: Telescope border and text highlights
vim.g.nightflyTransparent = 1
end,
})
use({
"marko-cerovac/material.nvim",
config = function()
vim.g.material_style = "palenight"
require("material").setup({
borders = true,
disable = {
background = true,
},
})
vim.cmd([[colorscheme material]])
end,
})
----------------------
-- Motion Utilities --
----------------------
-- Multiple cursors
use("mg979/vim-visual-multi")
-- Easy motion
use({
"phaazon/hop.nvim",
config = require("plugins.hop"),
})
-----------------------------
-- Project / Git Utilities --
-----------------------------
-- Project scope
-- TODO: check out https://github.com/ahmedkhalf/project.nvim
-- and its support for non-LSP projects?
-- https://github.com/ahmedkhalf/project.nvim
use("airblade/vim-rooter")
-- Project settings
use("tpope/vim-sleuth")
-- Git signs
use({
"lewis6991/gitsigns.nvim",
requires = "nvim-lua/plenary.nvim",
config = require("plugins.gitsigns"),
})
-- Git repo link
use({
"ruifm/gitlinker.nvim",
requires = "nvim-lua/plenary.nvim",
config = require("plugins.gitlinker"),
})
-- GitHub issues and pull requests
use({
"pwntester/octo.nvim",
config = function()
require("octo").setup()
end,
})
-----------------------------------
-- General Programming Utilities --
-----------------------------------
-- Language parser + syntax highlighting
-- TODO: install parsers for new file types (don't download all)
use({
"nvim-treesitter/nvim-treesitter",
run = ":TSUpdate",
config = require("plugins.treesitter"),
})
-- Treesitter parser info
use({
"nvim-treesitter/playground",
run = ":TSUpdate query",
requires = "nvim-treesitter/nvim-treesitter",
})
-- Treesitter text objects
use({
"nvim-treesitter/nvim-treesitter-textobjects",
branch = "0.5-compat",
requires = "nvim-treesitter",
})
-- GitHub Copilot (NOTE: requires neovim 0.6)
use({
"github/copilot.vim",
-- disable = true,
config = function()
-- imap <silent><script><expr> <C-L> copilot#Accept()
vim.g.copilot_no_tab_map = true
end,
})
-- Interactive scratchpad with virtual text
-- TODO: check out https://github.com/michaelb/sniprun
use("metakirby5/codi.vim")
-- Code formatter
use({
"mhartington/formatter.nvim",
config = require("lsp.formatter"),
})
-- Align lines by character
use({
"godlygeek/tabular",
config = require("plugins.tabular").setup,
})
-- Commenting
use("tpope/vim-commentary")
-- Better commentstring (for vim-commentary)
use({
"JoosepAlviste/nvim-ts-context-commentstring",
requires = "nvim-treesitter",
})
-- Surround with brackets
use("tpope/vim-surround")
-- Snippets
-- TODO: check out https://github.com/L3MON4D3/LuaSnip and Ultisnips
-- Snippet collection
use("rafamadriz/friendly-snippets")
-- Definable snippets
use("hrsh7th/vim-vsnip")
-- Docstring generator
use({
"kkoomen/vim-doge",
run = ":call doge#install()",
})
-- Autoclose and autorename html tag
use({
"windwp/nvim-ts-autotag",
requires = "nvim-treesitter/nvim-treesitter",
})
-- package.json dependency manager
-- TODO: can it check vulnerabilities?
use({
"vuki656/package-info.nvim",
requires = "MunifTanjim/nui.nvim",
ft = { "json" },
config = require("plugins.package"),
})
-- Python indenting issues
use("Vimjas/vim-python-pep8-indent")
---------------------------------
-- Compilation, Test and Debug --
---------------------------------
-- Make
use("neomake/neomake")
-- Compiler (e.g. :Dispatch python3.9 %)
use("tpope/vim-dispatch")
-- Unit test
use({
"rcarriga/vim-ultest",
requires = "vim-test/vim-test",
config = require("lsp.test").setup,
run = ":UpdateRemotePlugins",
})
-- Debugger
use({
"rcarriga/nvim-dap-ui",
requires = {
"mfussenegger/nvim-dap",
"theHamsta/nvim-dap-virtual-text",
"mfussenegger/nvim-dap-python",
},
config = require("lsp.debug"),
})
-- Debugger installer
use("Pocco81/DAPInstall.nvim")
-------------------
-- LSP Utilities --
-------------------
-- LSP config
use({
"neovim/nvim-lspconfig",
config = require("lsp.config"),
})
-- LSP install
-- use("williamboman/nvim-lsp-installer")
use({
"kabouzeid/nvim-lspinstall",
after = "nvim-lspconfig",
config = require("lsp.install"),
})
-- Java LSP
use("mfussenegger/nvim-jdtls")
-- LSP diagnostics toggle
use({
"WhoIsSethDaniel/toggle-lsp-diagnostics.nvim",
config = function()
require("toggle_lsp_diagnostics").init()
end,
})
-- Symbols outline
use("simrat39/symbols-outline.nvim")
-- Code action menu
use({
"weilbith/nvim-code-action-menu",
cmd = "CodeActionMenu",
})
-- Code action prompt
use({
"kosayoda/nvim-lightbulb",
config = function()
vim.cmd([[autocmd CursorHold,CursorHoldI * lua require'plugins.lightbulb'()]])
end,
})
-- Completion menu
use({
"hrsh7th/nvim-cmp",
requires = {
{ "windwp/nvim-autopairs" },
{ "lukas-reineke/cmp-under-comparator" },
{ "onsails/lspkind-nvim" },
{ "hrsh7th/cmp-nvim-lsp" },
{ "hrsh7th/cmp-nvim-lua" },
{ "hrsh7th/cmp-buffer" },
{ "hrsh7th/vim-vsnip" },
{ "hrsh7th/cmp-vsnip" },
{ "hrsh7th/cmp-path" },
{ "hrsh7th/cmp-calc" },
{ "hrsh7th/cmp-emoji" },
{ "hrsh7th/cmp-cmdline" },
{ "f3fora/cmp-spell" },
{ "kdheepak/cmp-latex-symbols" },
{ "David-Kunz/cmp-npm", requires = "nvim-lua/plenary.nvim" },
{ "petertriho/cmp-git", requires = "nvim-lua/plenary.nvim" },
-- { "tzachar/cmp-tabnine", run = "./install.sh", requires = "hrsh7th/nvim-cmp" },
-- "ray-x/cmp-treesitter",
-- "quangnguyen30192/cmp-nvim-tags",
-- "tpope/vim-dadbod",
-- "kristijanhusak/vim-dadbod-ui",
-- "kristijanhusak/vim-dadbod-completion",
-- "tzachar/cmp-fzy-buffer",
-- "tzachar/cmp-fuzzy-path",
},
config = require("lsp.cmp"),
})
-- Function signature
use({
"ray-x/lsp_signature.nvim",
config = require("lsp.signature"),
})
-------------------
-- Miscellaneous --
-------------------
-- Browser integration
use({
"glacambre/firenvim",
run = function()
vim.fn["firenvim#install"](0)
end,
config = require("plugins.firenvim"),
})
end)