@@ -171,7 +171,22 @@ vim.o.confirm = true
171171-- See `:help hlsearch`
172172vim .keymap .set (' n' , ' <Esc>' , ' <cmd>nohlsearch<CR>' )
173173
174- -- Diagnostic keymaps
174+ -- Diagnostic Config & Keymaps
175+ -- See :help vim.diagnostic.Opts
176+ vim .diagnostic .config {
177+ update_in_insert = false ,
178+ severity_sort = true ,
179+ float = { border = ' rounded' , source = ' if_many' },
180+ underline = { severity = vim .diagnostic .severity .ERROR },
181+
182+ -- Can switch between these as you prefer
183+ virtual_text = true , -- Text shows up at the end of the line
184+ virtual_lines = false , -- Teest shows up underneath the line, with virtual lines
185+
186+ -- Auto open the float, so you can easily read the errors when jumping with `[d` and `]d`
187+ jump = { float = true },
188+ }
189+
175190vim .keymap .set (' n' , ' <leader>q' , vim .diagnostic .setloclist , { desc = ' Open diagnostic [Q]uickfix list' })
176191
177192-- Exit terminal mode in the builtin terminal with a shortcut that is a bit easier
@@ -373,9 +388,7 @@ require('lazy').setup({
373388 -- },
374389 -- pickers = {}
375390 extensions = {
376- [' ui-select' ] = {
377- require (' telescope.themes' ).get_dropdown (),
378- },
391+ [' ui-select' ] = { require (' telescope.themes' ).get_dropdown () },
379392 },
380393 }
381394
@@ -398,11 +411,7 @@ require('lazy').setup({
398411 vim .keymap .set (' n' , ' <leader><leader>' , builtin .buffers , { desc = ' [ ] Find existing buffers' })
399412
400413 -- This runs on LSP attach per buffer (see main LSP attach function in 'neovim/nvim-lspconfig' config for more info,
401- -- it is better explained there). This is a little bit redundant, but we can switch off telescope for an optional
402- -- picker like snacks more easily when the keymaps are defined in the plugin itself.
403- -- It sets up buffer-local keymaps, autocommands, and other LSP-related settings
404- -- whenever an LSP client attaches to a buffer.
405-
414+ -- it is better explained there). This allows easily switching between pickers if you prefer using something else!
406415 vim .api .nvim_create_autocmd (' LspAttach' , {
407416 group = vim .api .nvim_create_augroup (' telescope-lsp-attach' , { clear = true }),
408417 callback = function (event )
@@ -435,7 +444,7 @@ require('lazy').setup({
435444 end ,
436445 })
437446
438- -- Slightly advanced example of overriding default behavior and theme
447+ -- Override default behavior and theme when searching
439448 vim .keymap .set (' n' , ' <leader>/' , function ()
440449 -- You can pass additional configuration to Telescope to change the theme, layout, etc.
441450 builtin .current_buffer_fuzzy_find (require (' telescope.themes' ).get_dropdown {
@@ -472,7 +481,6 @@ require('lazy').setup({
472481 -- Mason must be loaded before its dependents so we need to set it up here.
473482 -- NOTE: `opts = {}` is the same as calling `require('mason').setup({})`
474483 { ' mason-org/mason.nvim' , opts = {} },
475- ' mason-org/mason-lspconfig.nvim' ,
476484 ' WhoIsSethDaniel/mason-tool-installer.nvim' ,
477485
478486 -- Useful status updates for LSP.
@@ -575,22 +583,6 @@ require('lazy').setup({
575583 end ,
576584 })
577585
578- -- Diagnostic Config
579- -- See :help vim.diagnostic.Opts
580- vim .diagnostic .config {
581- update_in_insert = false ,
582- severity_sort = true ,
583- float = { border = ' rounded' , source = ' if_many' },
584- underline = { severity = vim .diagnostic .severity .ERROR },
585-
586- -- Can switch between these as you prefer
587- virtual_text = true , -- Text shows up at the end of the line
588- virtual_lines = false , -- Teest shows up underneath the line, with virtual lines
589-
590- -- Auto open the float, so you can easily read the errors when jumping with `[d` and `]d`
591- jump = { float = true },
592- }
593-
594586 -- LSP servers and clients are able to communicate to each other what features they support.
595587 -- By default, Neovim doesn't support everything that is in the LSP specification.
596588 -- When you add blink.cmp, luasnip, etc. Neovim now has *more* capabilities.
@@ -599,19 +591,12 @@ require('lazy').setup({
599591
600592 -- Enable the following language servers
601593 -- Feel free to add/remove any LSPs that you want here. They will automatically be installed.
602- --
603- -- Add any additional override configuration in the following tables. Available keys are:
604- -- - cmd (table): Override the default command used to start the server
605- -- - filetypes (table): Override the default list of associated filetypes for the server
606- -- - capabilities (table): Override fields in capabilities. Can be used to disable certain LSP features.
607- -- - settings (table): Override the default settings passed when initializing the server.
608- -- For example, to see the options for `lua_ls`, you could go to: https://luals.github.io/wiki/settings/
594+ -- See `:help lsp-config` for information about keys and how to configure
609595 local servers = {
610596 -- clangd = {},
611597 -- gopls = {},
612598 -- pyright = {},
613599 -- rust_analyzer = {},
614- -- ... etc. See `:help lspconfig-all` for a list of all the pre-configured LSPs
615600 --
616601 -- Some languages (like typescript) have entire language plugins that can be useful:
617602 -- https://github.com/pmizio/typescript-tools.nvim
@@ -629,6 +614,7 @@ require('lazy').setup({
629614 -- You can press `g?` for help in this menu.
630615 local ensure_installed = vim .tbl_keys (servers or {})
631616 vim .list_extend (ensure_installed , {
617+ ' lua_ls' , -- Lua Language server
632618 ' stylua' , -- Used to format Lua code
633619 -- You can add other tools here that you want Mason to install
634620 })
@@ -641,6 +627,7 @@ require('lazy').setup({
641627 vim .lsp .enable (name )
642628 end
643629
630+ -- Special Lua Config, as recommended by neovim help docs
644631 vim .lsp .config (' lua_ls' , {
645632 on_init = function (client )
646633 if client .workspace_folders then
@@ -651,10 +638,7 @@ require('lazy').setup({
651638 client .config .settings .Lua = vim .tbl_deep_extend (' force' , client .config .settings .Lua , {
652639 runtime = {
653640 version = ' LuaJIT' ,
654- path = {
655- ' lua/?.lua' ,
656- ' lua/?/init.lua' ,
657- },
641+ path = { ' lua/?.lua' , ' lua/?/init.lua' },
658642 },
659643 workspace = {
660644 checkThirdParty = false ,
@@ -864,6 +848,7 @@ require('lazy').setup({
864848 -- Check out: https://github.com/nvim-mini/mini.nvim
865849 end ,
866850 },
851+
867852 { -- Highlight, edit, and navigate code
868853 ' nvim-treesitter/nvim-treesitter' ,
869854 config = function ()
0 commit comments