forked from nvim-lua/kickstart.nvim
-
Notifications
You must be signed in to change notification settings - Fork 0
/
init.lua
819 lines (753 loc) · 27.4 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
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
-- Leader Definition
vim.g.mapleader = " "
vim.g.maplocalleader = " "
-- Fira Code is installed and is a Nerd Font
vim.g.have_nerd_font = true
-- Standard Options
vim.opt.mouse = "a"
vim.opt.showmode = true
vim.opt.clipboard = "unnamedplus"
vim.opt.undofile = true
vim.opt.ignorecase = true
vim.opt.smartcase = true
vim.opt.signcolumn = "yes"
vim.opt.updatetime = 400
vim.opt.timeoutlen = 300
-- Number line stuff
vim.opt.number = false
vim.opt.relativenumber = false
-- Indent Stuf
vim.opt.smartindent = false
vim.opt.autoindent = false
vim.opt.breakindent = true
vim.opt.list = true
vim.opt.listchars = { tab = "» ", trail = "·", nbsp = "␣" }
-- Split Stuff
vim.opt.splitright = true
vim.opt.splitbelow = true
-- Show Command while writing it
vim.opt.inccommand = "split"
-- Markc clearly current line and column
vim.opt.cursorline = true
vim.opt.cursorcolumn = true
-- vim.opt.guicursor = ""
-- Scroll Stuff
vim.opt.scrolloff = 7
vim.opt.sidescrolloff = 0
vim.opt.colorcolumn = "81"
-- Wrap Stuff
-- vim.o.nowrap = false
vim.wo.wrap = true
-- Tab/Spaces Stuff
vim.opt.tabstop = 8
vim.opt.shiftwidth = 8
vim.opt.expandtab = false
vim.opt.conceallevel = 1 -- don't know what is does lol
-- vim.opt.inccommand = true -- same
vim.opt.linebreak = true
vim.opt.whichwrap = "<,>,[,],h,l"
vim.opt.textwidth = 80
vim.opt.hlsearch = true
vim.keymap.set("n", "<Esc>", "<cmd>nohlsearch<CR>")
-- Diagnostic keymaps
vim.keymap.set("n", "[d", vim.diagnostic.goto_prev, { desc = "Go to previous [D]iagnostic message" })
vim.keymap.set("n", "]d", vim.diagnostic.goto_next, { desc = "Go to next [D]iagnostic message" })
vim.keymap.set("n", "<leader>e", vim.diagnostic.open_float, { desc = "Show diagnostic [E]rror messages" })
vim.keymap.set("n", "<leader>q", vim.diagnostic.setloclist, { desc = "Open diagnostic [Q]uickfix list" })
-- Exit Terminal with double escape
vim.keymap.set("t", "<Esc><Esc>", "<C-\\><C-n>", { desc = "Exit terminal mode" })
-- Disable arrow keys
vim.keymap.set("n", "<left>", '<cmd>echo "Use h to move!!"<CR>')
vim.keymap.set("n", "<right>", '<cmd>echo "Use l to move!!"<CR>')
vim.keymap.set("n", "<up>", '<cmd>echo "Use k to move!!"<CR>')
vim.keymap.set("n", "<down>", '<cmd>echo "Use j to move!!"<CR>')
-- Navigation between window
vim.keymap.set("n", "<C-h>", "<C-w><C-h>", { desc = "Move focus to the left window" })
vim.keymap.set("n", "<C-l>", "<C-w><C-l>", { desc = "Move focus to the right window" })
vim.keymap.set("n", "<C-j>", "<C-w><C-j>", { desc = "Move focus to the lower window" })
vim.keymap.set("n", "<C-k>", "<C-w><C-k>", { desc = "Move focus to the upper window" })
vim.api.nvim_create_autocmd("TextYankPost", { -- highlight yank text
desc = "Highlight when yanking (copying) text",
group = vim.api.nvim_create_augroup("kickstart-highlight-yank", { clear = true }),
callback = function()
vim.highlight.on_yank()
end,
})
local lazypath = vim.fn.stdpath "data" .. "/lazy/lazy.nvim"
if not vim.loop.fs_stat(lazypath) then
local lazyrepo = "https://github.com/folke/lazy.nvim.git"
vim.fn.system {
"git",
"clone",
"--filter=blob:none",
"--branch=stable",
lazyrepo,
lazypath,
}
end ---@diagnostic disable-next-line: undefined-field
vim.opt.rtp:prepend(lazypath)
require("lazy").setup({
"tpope/vim-sleuth", -- Detect tabstop and shiftwidth automatically
{ "numToStr/Comment.nvim", opts = {} }, -- gc / gcc comment block / line
{ -- Adds git related signs to the gutter, as well as utilities for managing changes
"lewis6991/gitsigns.nvim",
opts = {
signs = {
add = { text = "+" },
change = { text = "~" },
delete = { text = "_" },
topdelete = { text = "‾" },
changedelete = { text = "~" },
},
},
},
{ -- Plugin to show keybinds
"folke/which-key.nvim",
event = "VimEnter", -- Sets the loading event to 'VimEnter'
config = function() -- This is the function that runs, AFTER loading
require("which-key").setup()
require("which-key").add {
{ "<leader>c", group = "[C]ode" },
{ "<leader>d", group = "[D]ocument" },
{ "<leader>r", group = "[R]ename" },
{ "<leader>s", group = "[S]earch" },
{ "<leader>w", group = "[W]orkspace" },
{ "<leader>t", group = "[T]oggle" },
{ "<leader>h", group = "Git [H]unk", mode = { "n", "v" } },
}
end,
},
{ -- Fuzzy Finder
"nvim-telescope/telescope.nvim",
event = "VimEnter",
branch = "0.1.x",
dependencies = {
"nvim-lua/plenary.nvim",
{ "nvim-telescope/telescope-fzf-native.nvim" },
{ "nvim-telescope/telescope-ui-select.nvim" },
{ "nvim-tree/nvim-web-devicons", enabled = vim.g.have_nerd_font },
},
config = function()
-- Two important keymaps to use while in Telescope are:
-- - Insert mode: <c-/>
-- - Normal mode: ?
require("telescope").setup {
-- You can put your default mappings / updates / etc. in here
-- All the info you're looking for is in `:help telescope.setup()`
defaults = {
mappings = {
i = { ["<c-enter>"] = "to_fuzzy_refine" },
},
layout_config = {
width = function(_, cols, _)
if cols > 200 then
return 180
else
return cols
end
end,
height = 200,
preview_cutoff = 80,
},
},
extensions = {
["ui-select"] = {
require("telescope.themes").get_dropdown(),
},
},
}
-- Enable Telescope extensions if they are installed
pcall(require("telescope").load_extension, "fzf")
pcall(require("telescope").load_extension, "ui-select")
-- See `:help telescope.builtin`
local builtin = require "telescope.builtin"
vim.keymap.set("n", "<leader>sh", builtin.help_tags, { desc = "[S]earch [H]elp" })
vim.keymap.set("n", "<leader>sk", builtin.keymaps, { desc = "[S]earch [K]eymaps" })
vim.keymap.set("n", "<leader>sf", builtin.find_files, { desc = "[S]earch [F]iles" })
vim.keymap.set("n", "<leader>ss", builtin.builtin, { desc = "[S]earch [S]elect Telescope" })
vim.keymap.set("n", "<leader>sw", builtin.grep_string, { desc = "[S]earch current [W]ord" })
vim.keymap.set("n", "<leader>sg", builtin.live_grep, { desc = "[S]earch by [G]rep" })
vim.keymap.set("n", "<leader>sd", builtin.diagnostics, { desc = "[S]earch [D]iagnostics" })
vim.keymap.set("n", "<leader>sr", builtin.resume, { desc = "[S]earch [R]esume" })
vim.keymap.set("n", "<leader>s.", builtin.oldfiles, { desc = '[S]earch Recent Files ("." for repeat)' })
vim.keymap.set("n", "<leader><leader>", builtin.buffers, { desc = "[ ] Find existing buffers" })
-- Slightly advanced example of overriding default behavior and theme
vim.keymap.set("n", "<leader>/", function()
-- You can pass additional configuration to Telescope to change the theme, layout, etc.
builtin.current_buffer_fuzzy_find(require("telescope.themes").get_dropdown {
winblend = 10,
previewer = false,
})
end, { desc = "[/] Fuzzily search in current buffer" })
-- It's also possible to pass additional configuration options.
-- See `:help telescope.builtin.live_grep()` for information about particular keys
vim.keymap.set("n", "<leader>s/", function()
builtin.live_grep {
grep_open_files = true,
prompt_title = "Live Grep in Open Files",
}
end, { desc = "[S]earch [/] in Open Files" })
-- Shortcut for searching your Neovim configuration files
vim.keymap.set("n", "<leader>sn", function()
builtin.find_files { cwd = vim.fn.stdpath "config" }
end, { desc = "[S]earch [N]eovim files" })
end,
},
{ -- LSP Configuration & Plugins
"neovim/nvim-lspconfig",
dependencies = {
-- NOTE: `opts = {}` is the same as calling `require('fidget').setup({})`
"kevinhwang91/nvim-ufo",
{ "j-hui/fidget.nvim", opts = {} },
{ "folke/neodev.nvim", opts = {} },
},
config = function()
vim.api.nvim_create_autocmd("LspAttach", {
group = vim.api.nvim_create_augroup("kickstart-lsp-attach", { clear = true }),
callback = function(event)
local map = function(keys, func, desc)
vim.keymap.set("n", keys, func, { buffer = event.buf, desc = "LSP: " .. desc })
end
-- To jump back, press <C-t>.
map("gd", require("telescope.builtin").lsp_definitions, "[G]oto [D]efinition")
map("gr", require("telescope.builtin").lsp_references, "[G]oto [R]eferences")
map("gI", require("telescope.builtin").lsp_implementations, "[G]oto [I]mplementation")
map("<leader>D", require("telescope.builtin").lsp_type_definitions, "Type [D]efinition")
map("<leader>ds", require("telescope.builtin").lsp_document_symbols, "[D]ocument [S]ymbols")
map("<leader>ws", require("telescope.builtin").lsp_dynamic_workspace_symbols, "[W]orkspace [S]ymbols")
map("<leader>rn", vim.lsp.buf.rename, "[R]e[n]ame")
map("<leader>ca", vim.lsp.buf.code_action, "[C]ode [A]ction")
map("K", vim.lsp.buf.hover, "Hover Documentation")
map("gD", vim.lsp.buf.declaration, "[G]oto [D]eclaration")
local client = vim.lsp.get_client_by_id(event.data.client_id)
if client and client.server_capabilities.documentHighlightProvider then
vim.api.nvim_create_autocmd({ "CursorHold", "CursorHoldI" }, {
buffer = event.buf,
callback = vim.lsp.buf.document_highlight,
})
vim.api.nvim_create_autocmd({ "CursorMoved", "CursorMovedI" }, {
buffer = event.buf,
callback = vim.lsp.buf.clear_references,
})
end
end,
})
print "Lsp Attach auto command done fine"
-- LSP servers and clients are able to communicate to each other what features they support.
-- By default, Neovim doesn't support everything that is in the LSP specification.
-- When you add nvim-cmp, luasnip, etc. Neovim now has *more* capabilities.
-- So, we create new capabilities with nvim cmp, and then broadcast that to the servers.
local capabilities = vim.lsp.protocol.make_client_capabilities()
capabilities = vim.tbl_deep_extend("force", capabilities, require("cmp_nvim_lsp").default_capabilities())
-- Add any additional override configuration in the following tables. Available keys are:
-- - cmd (table): Override the default command used to start the server
-- - filetypes (table): Override the default list of associated filetypes for the server
-- - capabilities (table): Override fields in capabilities. Can be used to disable certain LSP features.
-- - settings (table): Override the default settings passed when initializing the server.
-- For example, to see the options for `lua_ls`, you could go to: https://luals.github.io/wiki/settings/
local lsp_capabilities = require("cmp_nvim_lsp").default_capabilities()
-- RUST
require("lspconfig")["rust_analyzer"].setup {
on_attach = function(client, bufnr)
vim.lsp.inlay_hint.enable(true, { bufnr = bufnr })
end,
capabilities = lsp_capabilities,
settings = {
["rust-analyzer"] = {
imports = {
granularity = {
group = "module",
},
prefix = "self",
},
cargo = {
buildScripts = {
enable = true,
},
},
procMacro = {
enable = true,
},
},
},
}
require("lspconfig").nixd.setup {
cmd = { "nixd" },
settings = {
nixd = {
nixpkgs = {
expr = "import <nixpkgs> { }"
},
formatting = {
command = { "nixpkgs-fmt" },
}
}
}
}
-- TINYMIST
require("lspconfig")["tinymist"].setup {
capabilities = lsp_capabilities,
root_dir = function(filename, bufnr)
return "/home/pauladam/PaulJR/"
end,
settings = {
tinymist = {
settings = {
formatterMode = "typstfmt",
},
},
},
}
-- OCaml
require("lspconfig")["ocamllsp"].setup {
capabilities = lsp_capabilities,
root_dir = function(filename, bufnr)
return vim.fn.getcwd()
end,
}
-- TYPESCRIPT
-- tsserver deprecate use 'ts_ls' instead
-- require("lspconfig")["tsserver"].setup {
-- capabilities = lsp_capabilities,
-- }
-- CLANGD
require("lspconfig")["clangd"].setup {
capabilities = lsp_capabilities,
}
-- COQ
require("lspconfig")["coq_lsp"].setup {
capabilities = lsp_capabilities,
}
-- LUA LS
require("lspconfig")["lua_ls"].setup {
capabilities = lsp_capabilities,
cmd = { "lua-lsp" },
settings = {
-- cmd = {'lua-lsp'},
-- Lua = {
-- diagnostics = { globals = { 'vim' } },
-- completion = {
-- callSnippet = "Replace",
-- },
-- },
},
}
end,
},
{ -- Autocompletion
"hrsh7th/nvim-cmp",
event = "InsertEnter",
dependencies = {
-- Snippet Engine & its associated nvim-cmp source
{
"L3MON4D3/LuaSnip",
build = (function()
-- Build Step is needed for regex support in snippets.
-- This step is not supported in many windows environments.
-- Remove the below condition to re-enable on windows.
if vim.fn.has "win32" == 1 or vim.fn.executable "make" == 0 then
return
end
return "make install_jsregexp"
end)(),
dependencies = {
-- `friendly-snippets` contains a variety of premade snippets.
-- See the README about individual language/framework/plugin snippets:
-- https://github.com/rafamadriz/friendly-snippets
-- {
-- 'rafamadriz/friendly-snippets',
-- config = function()
-- require('luasnip.loaders.from_vscode').lazy_load()
-- end,
-- },
},
},
"saadparwaiz1/cmp_luasnip",
"hrsh7th/cmp-nvim-lsp",
"hrsh7th/cmp-path",
},
config = function()
-- See `:help cmp`
local cmp = require "cmp"
local luasnip = require "luasnip"
luasnip.config.setup {}
cmp.setup {
snippet = {
expand = function(args)
luasnip.lsp_expand(args.body)
end,
},
completion = { completeopt = "menu,menuone,noinsert" },
-- For an understanding of why these mappings were
-- chosen, you will need to read `:help ins-completion`
--
-- No, but seriously. Please read `:help ins-completion`, it is really good!
mapping = cmp.mapping.preset.insert {
-- Select the [n]ext item
["<C-n>"] = cmp.mapping.select_next_item(),
-- Select the [p]revious item
["<C-p>"] = cmp.mapping.select_prev_item(),
-- Scroll the documentation window [b]ack / [f]orward
["<C-b>"] = cmp.mapping.scroll_docs(-4),
["<C-f>"] = cmp.mapping.scroll_docs(4),
-- Accept ([y]es) the completion.
-- This will auto-import if your LSP supports it.
-- This will expand snippets if the LSP sent a snippet.
["<C-y>"] = cmp.mapping.confirm { select = true },
-- If you prefer more traditional completion keymaps,
-- you can uncomment the following lines
--['<CR>'] = cmp.mapping.confirm { select = true },
--['<Tab>'] = cmp.mapping.select_next_item(),
--['<S-Tab>'] = cmp.mapping.select_prev_item(),
-- Manually trigger a completion from nvim-cmp.
-- Generally you don't need this, because nvim-cmp will display
-- completions whenever it has completion options available.
["<C-Space>"] = cmp.mapping.complete {},
-- Think of <c-l> as moving to the right of your snippet expansion.
-- So if you have a snippet that's like:
-- function $name($args)
-- $body
-- end
--
-- <c-l> will move you to the right of each of the expansion locations.
-- <c-h> is similar, except moving you backwards.
["<C-l>"] = cmp.mapping(function()
if luasnip.expand_or_locally_jumpable() then
luasnip.expand_or_jump()
end
end, { "i", "s" }),
["<C-h>"] = cmp.mapping(function()
if luasnip.locally_jumpable(-1) then
luasnip.jump(-1)
end
end, { "i", "s" }),
-- For more advanced Luasnip keymaps (e.g. selecting choice nodes, expansion) see:
-- https://github.com/L3MON4D3/LuaSnip?tab=readme-ov-file#keymaps
},
sources = {
{
name = "lazydev",
-- set group index to 0 to skip loading LuaLS completions as lazydev recommends it
group_index = 0,
},
{ name = "nvim_lsp" },
{ name = "luasnip" },
{ name = "luasnip" },
{ name = "path" },
},
}
end,
},
{
"folke/tokyonight.nvim",
priority = 1000, -- Make sure to load this before all the other start plugins.
init = function()
-- light : delek / quiet / shine / peachpuff'
vim.cmd.colorscheme "tokyonight-day"
-- You can configure highlights by doing something like:
vim.cmd.hi "Comment gui=none"
end,
},
-- Highlight todo, notes, etc in comments
{
"folke/todo-comments.nvim",
event = "VimEnter",
dependencies = { "nvim-lua/plenary.nvim" },
opts = { signs = false },
},
{ -- Collection of various small independent plugins/modules
"echasnovski/mini.nvim",
config = function()
-- Better Around/Inside textobjects
-- Examples:
-- - va) - [V]isually select [A]round [)]paren
-- - yinq - [Y]ank [I]nside [N]ext [']quote
-- - ci' - [C]hange [I]nside [']quote
require("mini.ai").setup { n_lines = 500 }
-- Add/delete/replace surroundings (brackets, quotes, etc.)
-- - saiw) - [S]urround [A]dd [I]nner [W]ord [)]Paren
-- - sd' - [S]urround [D]elete [']quotes
-- - sr)' - [S]urround [R]eplace [)] [']
require("mini.surround").setup()
local statusline = require "mini.statusline"
statusline.setup { use_icons = vim.g.have_nerd_font }
---@diagnostic disable-next-line: duplicate-set-field
statusline.section_location = function()
return "%2l:%-2v"
end
end,
},
{
"nvim-treesitter/nvim-treesitter",
build = ":TSUpdate",
opts = {
ensure_installed = {
"bash",
"c",
"rust",
"python",
"html",
"lua",
"markdown",
"vim",
"vimdoc",
"typst",
},
-- Autoinstall languages that are not installed
auto_install = true,
highlight = {
enable = true,
-- additional_vim_regex_highlighting = { 'ruby' },
},
indent = { enable = true, disable = { "ruby" } },
},
config = function(_, opts)
---@diagnostic disable-next-line: missing-fields
require("nvim-treesitter.configs").setup(opts)
end,
},
{
"mfussenegger/nvim-dap",
dependencies = {
-- Creates a beautiful debugger UI
"rcarriga/nvim-dap-ui",
-- Required dependency for nvim-dap-ui
"nvim-neotest/nvim-nio",
-- Installs the debug adapters for you
"williamboman/mason.nvim",
"jay-babu/mason-nvim-dap.nvim",
-- Add your own debuggers here
"leoluz/nvim-dap-go", -- add lua debugger
},
keys = function(_, keys)
local dap = require "dap"
local dapui = require "dapui"
return {
-- Basic debugging keymaps, feel free to change to your liking!
{ "<F5>", dap.continue, desc = "Debug: Start/Continue" },
{ "<F1>", dap.step_into, desc = "Debug: Step Into" },
{ "<F2>", dap.step_over, desc = "Debug: Step Over" },
{ "<F3>", dap.step_out, desc = "Debug: Step Out" },
{
"<leader>b",
dap.toggle_breakpoint,
desc = "Debug: Toggle Breakpoint",
},
{
"<leader>B",
function()
dap.set_breakpoint(vim.fn.input "Breakpoint condition: ")
end,
desc = "Debug: Set Breakpoint",
},
-- Toggle to see last session result. Without this, you can't see session output in case of unhandled exception.
{ "<F7>", dapui.toggle, desc = "Debug: See last session result." },
unpack(keys),
}
end,
config = function()
local dap = require "dap"
local dapui = require "dapui"
require("mason-nvim-dap").setup {
-- Makes a best effort to setup the various debuggers with
-- reasonable debug configurations
automatic_installation = true,
-- You can provide additional configuration to the handlers,
-- see mason-nvim-dap README for more information
handlers = {},
-- You'll need to check that you have the required things installed
-- online, please don't ask me how to install them :)
ensure_installed = {
-- Update this to ensure that you have the debuggers for the langs you want
"delve",
},
}
-- Dap UI setup
-- For more information, see |:help nvim-dap-ui|
dapui.setup {
-- Set icons to characters that are more likely to work in every terminal.
-- Feel free to remove or use ones that you like more! :)
-- Don't feel like these are good choices.
icons = { expanded = "▾", collapsed = "▸", current_frame = "*" },
controls = {
icons = {
pause = "⏸",
play = "▶",
step_into = "⏎",
step_over = "⏭",
step_out = "⏮",
step_back = "b",
run_last = "▶▶",
terminate = "⏹",
disconnect = "⏏",
},
},
}
dap.listeners.after.event_initialized["dapui_config"] = dapui.open
dap.listeners.before.event_terminated["dapui_config"] = dapui.close
dap.listeners.before.event_exited["dapui_config"] = dapui.close
-- Install golang specific config
require("dap-go").setup {
delve = {
-- On Windows delve must be run attached or it crashes.
-- See https://github.com/leoluz/nvim-dap-go/blob/main/README.md#configuring
detached = vim.fn.has "win32" == 0,
},
}
end,
},
-- require 'kickstart.plugins.debug',
-- require 'kickstart.plugins.indent_line',
-- require 'kickstart.plugins.lint',
-- Uncomment the following line and add your plugins to `lua/custom/plugins/*.lua` to get going.
-- { import = 'custom.plugins' },
{
"kdheepak/lazygit.nvim",
cmd = {
"LazyGit",
},
dependencies = {
"nvim-lua/plenary.nvim",
},
},
"mbbill/undotree",
"bellinitte/uxntal.vim",
"Pocco81/auto-save.nvim",
{
"nvim-tree/nvim-tree.lua",
dependencies = {
"nvim-tree/nvim-web-devicons",
},
config = function()
require("nvim-tree").setup {
filters = {
dotfiles = false,
custom = { "^.git$" },
},
-- filters = {
-- dotfiles = false,
-- custom = { "^.git$" },
-- },
diagnostics = {
enable = true,
icons = {
hint = "",
info = "",
warning = "",
error = "",
},
show_on_dirs = true,
},
view = {
signcolumn = "yes",
},
}
end,
},
{
"chomosuke/typst-preview.nvim",
lazy = false, -- or ft = 'typst'
version = "0.3.*",
build = function()
require("typst-preview").update()
end,
},
{
"S1M0N38/love2d.nvim",
cmd = "LoveRun",
opts = {},
},
{
"saecki/crates.nvim",
tag = "stable",
config = function()
require("crates").setup()
end,
},
{
"whonore/Coqtail",
config = function()
vim.keymap.set("n", "<A-j>", vim.cmd.CoqToLine, { desc = "Coq to Cursor" })
vim.keymap.set("n", "<c-A-j>", vim.cmd.CoqNext, { desc = "Coq Next" })
vim.keymap.set("n", "<c-A-k>", vim.cmd.CoqUndo, { desc = "Coq Undo" })
end,
},
-- 'windwp/nvim-autopairs',
-- 'mrcjkb/rustaceanvim',
-- test rooter
-- autoformat : 'stevearc/conform.nvim',
-- hardtime.nvim (tells you when there is better command to do something)
}, {
ui = {
-- If you are using a Nerd Font: set icons to an empty table which will use the
-- default lazy.nvim defined Nerd Font icons, otherwise define a unicode icons table
icons = vim.g.have_nerd_font and {} or {
cmd = "⌘",
config = "🛠",
event = "📅",
ft = "📂",
init = "⚙",
keys = "🗝",
plugin = "🔌",
runtime = "💻",
require = "🌙",
source = "📄",
start = "🚀",
task = "📌",
lazy = "💤 ",
},
},
})
-- vim.diagnostic.config({ virtual_text = false })
-- LSP test in all modes (worked)
vim.lsp.handlers["textDocument/publishDiagnostics"] = vim.lsp.with(vim.lsp.diagnostic.on_publish_diagnostics, {
-- delay update diagnostics
update_in_insert = true,
})
vim.diagnostic.config { update_in_insert = true }
vim.api.nvim_create_user_command("Format", function(_)
if vim.bo.filetype == "lua" then
vim.cmd ":!stylua %"
elseif vim.bo.filetype == "nix" then
vim.cmd ":!nixpkgs-fmt %"
-- elseif vim.bo.filetype == "ocaml" then
-- vim.cmd ":!ocamlformat %"
else
vim.lsp.buf.format()
end
end, { desc = "Format current buffer with LSP" })
vim.api.nvim_create_user_command("TinymistPreview", function(_)
vim.cmd ":silent !tinymist preview %"
end, { desc = "Begin TinymistPreview" })
-- format typst file
vim.keymap.set("n", "<leader>f", vim.cmd.Format, { desc = "[F]ormat file" })
-- TODO use the config argument (that gives the config path)
vim.api.nvim_create_user_command("Config", "edit ~/.config/nvim/init.lua", {})
-- love2D shortcut
vim.api.nvim_create_user_command("Love2DRun", function()
-- print(vim.loop.cwd())
os.execute("love " .. vim.loop.cwd())
end, { desc = "Run Love2D Project" })
vim.api.nvim_create_user_command("PresentationMode", function()
vim.opt.listchars = { tab = "» ", trail = " ", nbsp = "␣" }
vim.opt.relativenumber = false
vim.opt.number = false
vim.opt.scrolloff = 0
vim.opt.sidescrolloff = 0
vim.opt.signcolumn = "no"
vim.opt.laststatus = 0
vim.opt.colorcolumn = ""
end, { desc = "Changes to present something" })
vim.keymap.set("n", "<leader>pu", vim.cmd.UndotreeToggle, { desc = "[P]op Tree [U]ndo" })
vim.keymap.set("n", "<leader>pf", vim.cmd.NvimTreeToggle, { desc = "[P]op Tree [F]ile" })
vim.keymap.set("n", "<leader>pt", function()
-- TODO make a real toggle
vim.api.nvim_command "split"
vim.api.nvim_command "terminal"
end, { desc = "[P]op [T]erminal" })
-- vim.keymap.set({ 'n', 'v' }, 'j', 'gj') -- visual j
-- vim.keymap.set({ 'n', 'v' }, 'k', 'gk') -- visual k
vim.keymap.set("n", "x", '"0x') -- x does not influence past register
vim.keymap.set("n", "<leader>a", "gg0vG$y<C-O>", { desc = "Yank [A]ll File" })
-- paste only something that was paste
-- vim.keymap.set('n', 'p', '"0p')