|
179 | 179 | -- See `:help hlsearch` |
180 | 180 | vim.keymap.set('n', '<Esc>', '<cmd>nohlsearch<CR>') |
181 | 181 |
|
| 182 | + -- [[ Diagnostic Configuration ]] |
| 183 | + -- See `:help vim.diagnostic.Opts` |
| 184 | + vim.diagnostic.config { |
| 185 | + update_in_insert = false, |
| 186 | + severity_sort = true, |
| 187 | + float = { border = 'rounded', source = 'if_many' }, |
| 188 | + underline = { severity = { min = vim.diagnostic.severity.WARN } }, |
| 189 | + |
| 190 | + -- Can switch between these as you prefer |
| 191 | + virtual_text = true, -- Text shows up at the end of the line |
| 192 | + virtual_lines = false, -- Text shows up underneath the line, with virtual lines |
| 193 | + |
| 194 | + -- Auto open the float, so you can easily read the errors when jumping with `[d` and `]d` |
| 195 | + jump = { float = true }, |
| 196 | + } |
| 197 | + |
| 198 | + vim.keymap.set('n', '<leader>q', vim.diagnostic.setloclist, { desc = 'Open diagnostic [Q]uickfix list' }) |
| 199 | + |
182 | 200 | -- Exit terminal mode in the builtin terminal with a shortcut that is a bit easier |
183 | 201 | -- for people to discover. Otherwise, you normally need to press <C-\><C-n>, which |
184 | 202 | -- is not what someone will guess without a bit more experience. |
|
539 | 557 | end |
540 | 558 |
|
541 | 559 | -- ============================================================ |
542 | | --- SECTION 5: LANGUAGE TOOLING |
543 | | --- Diagnostics, LSP, Mason, formatting, autocompletion |
| 560 | +-- SECTION 5: LSP |
| 561 | +-- LSP keymaps, server configuration, Mason tools installations |
544 | 562 | -- ============================================================ |
545 | 563 | do |
546 | | - -- [[ Diagnostic Configuration ]] |
547 | | - -- See `:help vim.diagnostic.Opts` |
548 | | - vim.diagnostic.config { |
549 | | - update_in_insert = false, |
550 | | - severity_sort = true, |
551 | | - float = { border = 'rounded', source = 'if_many' }, |
552 | | - underline = { severity = { min = vim.diagnostic.severity.WARN } }, |
553 | | - |
554 | | - -- Can switch between these as you prefer |
555 | | - virtual_text = true, -- Text shows up at the end of the line |
556 | | - virtual_lines = false, -- Text shows up underneath the line, with virtual lines |
557 | | - |
558 | | - -- Auto open the float, so you can easily read the errors when jumping with `[d` and `]d` |
559 | | - jump = { float = true }, |
560 | | - } |
561 | | - |
562 | | - vim.keymap.set('n', '<leader>q', vim.diagnostic.setloclist, { desc = 'Open diagnostic [Q]uickfix list' }) |
563 | | - |
564 | 564 | -- [[ LSP Configuration ]] |
565 | 565 | -- Brief aside: **What is LSP?** |
566 | 566 | -- |
|
732 | 732 | vim.lsp.config(name, server) |
733 | 733 | vim.lsp.enable(name) |
734 | 734 | end |
| 735 | +end |
735 | 736 |
|
| 737 | +-- ============================================================ |
| 738 | +-- SECTION 6: FORMATTING |
| 739 | +-- conform.nvim setup and keymap |
| 740 | +-- ============================================================ |
| 741 | +do |
736 | 742 | -- [[ Formatting ]] |
737 | 743 | require('conform').setup { |
738 | 744 | notify_on_error = false, |
|
763 | 769 | } |
764 | 770 |
|
765 | 771 | vim.keymap.set({ 'n', 'v' }, '<leader>f', function() require('conform').format { async = true } end, { desc = '[F]ormat buffer' }) |
| 772 | +end |
766 | 773 |
|
767 | | - -- [[ Autocompletion Configuration ]] |
768 | | - |
769 | | - -- Snippet Engine |
| 774 | +-- ============================================================ |
| 775 | +-- SECTION 7: AUTOCOMPLETE & SNIPPETS |
| 776 | +-- blink.cmp and luasnip setup |
| 777 | +-- ============================================================ |
| 778 | +do |
| 779 | + -- [[ Snippet Engine ]] |
770 | 780 | require('luasnip').setup {} |
771 | 781 |
|
772 | 782 | -- `friendly-snippets` contains a variety of premade snippets. |
|
776 | 786 | -- vim.pack.add { gh 'rafamadriz/friendly-snippets' } |
777 | 787 | -- require('luasnip.loaders.from_vscode').lazy_load() |
778 | 788 |
|
779 | | - -- The autocomplete engine |
| 789 | + -- [[ Autocomplete Engine ]] |
780 | 790 | require('blink.cmp').setup { |
781 | 791 | keymap = { |
782 | 792 | -- 'default' (recommended) for mappings similar to built-in completions |
|
839 | 849 | end |
840 | 850 |
|
841 | 851 | -- ============================================================ |
842 | | --- SECTION 6: TREESITTER |
| 852 | +-- SECTION 8: TREESITTER |
843 | 853 | -- Parser installation, syntax highlighting, folds, indentation |
844 | 854 | -- ============================================================ |
845 | 855 | do |
|
898 | 908 | end |
899 | 909 |
|
900 | 910 | -- ============================================================ |
901 | | --- SECTION 7: OPTIONAL EXAMPLES / NEXT STEPS |
| 911 | +-- SECTION 9: OPTIONAL EXAMPLES / NEXT STEPS |
902 | 912 | -- kickstart.plugins.* examples |
903 | 913 | -- ============================================================ |
904 | 914 | do |
905 | | - |
906 | 915 | -- The following comments only work if you have downloaded the kickstart repo, not just copy pasted the |
907 | 916 | -- init.lua. If you want these files, they are in the repository, so you can just download them and |
908 | 917 | -- place them in the correct locations. |
|
0 commit comments