From e79572c9e6978787af2bca164a85ab6821caeb7b Mon Sep 17 00:00:00 2001 From: TJ DeVries Date: Tue, 27 Jan 2026 12:09:56 -0500 Subject: [PATCH] fix: continue cleaning up docs and config --- init.lua | 63 +++++++++++++++++++++----------------------------------- 1 file changed, 24 insertions(+), 39 deletions(-) diff --git a/init.lua b/init.lua index 6b7c82af..d5ae6dc9 100644 --- a/init.lua +++ b/init.lua @@ -171,7 +171,22 @@ vim.o.confirm = true -- See `:help hlsearch` vim.keymap.set('n', '', 'nohlsearch') --- Diagnostic keymaps +-- Diagnostic Config & Keymaps +-- See :help vim.diagnostic.Opts +vim.diagnostic.config { + update_in_insert = false, + severity_sort = true, + float = { border = 'rounded', source = 'if_many' }, + underline = { severity = vim.diagnostic.severity.ERROR }, + + -- Can switch between these as you prefer + virtual_text = true, -- Text shows up at the end of the line + virtual_lines = false, -- Teest shows up underneath the line, with virtual lines + + -- Auto open the float, so you can easily read the errors when jumping with `[d` and `]d` + jump = { float = true }, +} + vim.keymap.set('n', 'q', vim.diagnostic.setloclist, { desc = 'Open diagnostic [Q]uickfix list' }) -- Exit terminal mode in the builtin terminal with a shortcut that is a bit easier @@ -373,9 +388,7 @@ require('lazy').setup({ -- }, -- pickers = {} extensions = { - ['ui-select'] = { - require('telescope.themes').get_dropdown(), - }, + ['ui-select'] = { require('telescope.themes').get_dropdown() }, }, } @@ -398,11 +411,7 @@ require('lazy').setup({ vim.keymap.set('n', '', builtin.buffers, { desc = '[ ] Find existing buffers' }) -- This runs on LSP attach per buffer (see main LSP attach function in 'neovim/nvim-lspconfig' config for more info, - -- it is better explained there). This is a little bit redundant, but we can switch off telescope for an optional - -- picker like snacks more easily when the keymaps are defined in the plugin itself. - -- It sets up buffer-local keymaps, autocommands, and other LSP-related settings - -- whenever an LSP client attaches to a buffer. - + -- it is better explained there). This allows easily switching between pickers if you prefer using something else! vim.api.nvim_create_autocmd('LspAttach', { group = vim.api.nvim_create_augroup('telescope-lsp-attach', { clear = true }), callback = function(event) @@ -435,7 +444,7 @@ require('lazy').setup({ end, }) - -- Slightly advanced example of overriding default behavior and theme + -- Override default behavior and theme when searching vim.keymap.set('n', '/', function() -- You can pass additional configuration to Telescope to change the theme, layout, etc. builtin.current_buffer_fuzzy_find(require('telescope.themes').get_dropdown { @@ -472,7 +481,6 @@ require('lazy').setup({ -- Mason must be loaded before its dependents so we need to set it up here. -- NOTE: `opts = {}` is the same as calling `require('mason').setup({})` { 'mason-org/mason.nvim', opts = {} }, - 'mason-org/mason-lspconfig.nvim', 'WhoIsSethDaniel/mason-tool-installer.nvim', -- Useful status updates for LSP. @@ -575,22 +583,6 @@ require('lazy').setup({ end, }) - -- Diagnostic Config - -- See :help vim.diagnostic.Opts - vim.diagnostic.config { - update_in_insert = false, - severity_sort = true, - float = { border = 'rounded', source = 'if_many' }, - underline = { severity = vim.diagnostic.severity.ERROR }, - - -- Can switch between these as you prefer - virtual_text = true, -- Text shows up at the end of the line - virtual_lines = false, -- Teest shows up underneath the line, with virtual lines - - -- Auto open the float, so you can easily read the errors when jumping with `[d` and `]d` - jump = { float = true }, - } - -- 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 blink.cmp, luasnip, etc. Neovim now has *more* capabilities. @@ -599,19 +591,12 @@ require('lazy').setup({ -- Enable the following language servers -- Feel free to add/remove any LSPs that you want here. They will automatically be installed. - -- - -- 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/ + -- See `:help lsp-config` for information about keys and how to configure local servers = { -- clangd = {}, -- gopls = {}, -- pyright = {}, -- rust_analyzer = {}, - -- ... etc. See `:help lspconfig-all` for a list of all the pre-configured LSPs -- -- Some languages (like typescript) have entire language plugins that can be useful: -- https://github.com/pmizio/typescript-tools.nvim @@ -629,6 +614,7 @@ require('lazy').setup({ -- You can press `g?` for help in this menu. local ensure_installed = vim.tbl_keys(servers or {}) vim.list_extend(ensure_installed, { + 'lua_ls', -- Lua Language server 'stylua', -- Used to format Lua code -- You can add other tools here that you want Mason to install }) @@ -641,6 +627,7 @@ require('lazy').setup({ vim.lsp.enable(name) end + -- Special Lua Config, as recommended by neovim help docs vim.lsp.config('lua_ls', { on_init = function(client) if client.workspace_folders then @@ -651,10 +638,7 @@ require('lazy').setup({ client.config.settings.Lua = vim.tbl_deep_extend('force', client.config.settings.Lua, { runtime = { version = 'LuaJIT', - path = { - 'lua/?.lua', - 'lua/?/init.lua', - }, + path = { 'lua/?.lua', 'lua/?/init.lua' }, }, workspace = { checkThirdParty = false, @@ -864,6 +848,7 @@ require('lazy').setup({ -- Check out: https://github.com/nvim-mini/mini.nvim end, }, + { -- Highlight, edit, and navigate code 'nvim-treesitter/nvim-treesitter', config = function()