diff --git a/.config/nvim/init.lua b/.config/nvim/init.lua index a9782d6..a05809b 100644 --- a/.config/nvim/init.lua +++ b/.config/nvim/init.lua @@ -30,30 +30,8 @@ vim.cmd("noswapfile") vim.cmd("set autoread") vim.cmd("set complete-=i") -vim.cmd("set lazyredraw") vim.cmd("au FileType python set fileformat=unix encoding=utf-8") vim.cmd("au FileType markdown,tex set spell spelllang=en_us") --- ------------------------------------------------------------------------ --- Auto‑reload buffers when files change externally --- ------------------------------------------------------------------------ --- Ensure the option is enabled (already set above, but kept for clarity) -vim.cmd("set autoread") --- Create a dedicated augroup to avoid duplicate autocommands if this file --- is sourced multiple times (e.g., when using :source ~/.config/nvim/init.lua). -vim.api.nvim_create_augroup("AutoReload", { clear = true }) - --- Run `checktime` for the following events: --- * CursorHold, CursorHoldI – idle cursor, typical for auto‑check --- * FocusGained – when you return to Neovim from another app --- * BufEnter – when you jump to a buffer that may already be stale -vim.api.nvim_create_autocmd( - { "CursorHold", "CursorHoldI", "FocusGained", "BufEnter" }, - { - group = "AutoReload", - pattern = "*", - command = "silent! checktime", - } -) diff --git a/.config/nvim/lazy-lock.json b/.config/nvim/lazy-lock.json index eb29bbc..aa3d07d 100644 --- a/.config/nvim/lazy-lock.json +++ b/.config/nvim/lazy-lock.json @@ -1,6 +1,10 @@ { "black-metal-theme-neovim": { "branch": "main", "commit": "6d0207871387077f40d5396ab1ae90520e688d36" }, "lazy.nvim": { "branch": "main", "commit": "85c7ff3711b730b4030d03144f6db6375044ae82" }, + "mason-lspconfig.nvim": { "branch": "main", "commit": "3b3571b4dadbcb464804466e9872e7246c316af7" }, + "mason.nvim": { "branch": "main", "commit": "57e5a8addb8c71fb063ee4acda466c7cf6ad2800" }, + "mini.completion": { "branch": "main", "commit": "7c5edfc0e479dd4edd898cc9ddd1920d8c1ce420" }, + "mini.nvim": { "branch": "main", "commit": "6bd3a01aaf7d248aea1b78aacdd5d44bffa002c1" }, "nvim-lspconfig": { "branch": "master", "commit": "07f4e93de92e8d4ea7ab99602e3a8c9ac0fb778a" }, "nvim-treesitter": { "branch": "master", "commit": "42fc28ba918343ebfd5565147a42a26580579482" }, "plenary.nvim": { "branch": "master", "commit": "b9fd5226c2f76c951fc8ed5923d85e4de065e509" }, diff --git a/.config/nvim/lua/config/lazy.lua b/.config/nvim/lua/config/lazy.lua index 731cb05..205bc87 100644 --- a/.config/nvim/lua/config/lazy.lua +++ b/.config/nvim/lua/config/lazy.lua @@ -31,5 +31,5 @@ require("lazy").setup({ -- colorscheme that will be used when installing plugins. -- install = { colorscheme = { "habamax" } }, -- automatically check for plugin updates - checker = { enabled = true }, + -- checker = { enabled = true }, }) diff --git a/.config/nvim/lua/plugins/mason.lua b/.config/nvim/lua/plugins/mason.lua new file mode 100644 index 0000000..cd7b751 --- /dev/null +++ b/.config/nvim/lua/plugins/mason.lua @@ -0,0 +1,54 @@ +return { + "mason-org/mason-lspconfig.nvim", + dependencies = { + {"mason-org/mason.nvim"}, + {'neovim/nvim-lspconfig'}, + + {'nvim-mini/mini.nvim'}, + {'nvim-mini/mini.completion'}, + }, + config = function() + require("mason").setup() + require("mason-lspconfig").setup {} + + -- NOTE: this is meant to be backwards compatible with Neovim v0.9 + --- + -- Autocompletion + --- + + require('mini.snippets').setup() + require('mini.completion').setup() + + --- + -- Language server configuration + --- + + -- These keymaps are the defaults in Neovim v0.10 + if vim.fn.has('nvim-0.11') == 0 then + -- NOTE: vim.diagnostic.goto_* methods are deprecated in v0.11 + -- that's why we put these under a conditional block + vim.keymap.set('n', '[d', 'lua vim.diagnostic.goto_prev()') + vim.keymap.set('n', ']d', 'lua vim.diagnostic.goto_next()') + vim.keymap.set('n', 'd', 'lua vim.diagnostic.open_float()') + vim.keymap.set('n', '', 'lua vim.diagnostic.open_float()') + end + + vim.api.nvim_create_autocmd('LspAttach', { + callback = function(event) + local bufmap = function(mode, rhs, lhs) + vim.keymap.set(mode, rhs, lhs, {buffer = event.buf}) + end + + -- These keymaps are the defaults in Neovim v0.11 + bufmap('n', 'K', 'lua vim.lsp.buf.hover()') + bufmap('n', 'grr', 'lua vim.lsp.buf.references()') + bufmap('n', 'gri', 'lua vim.lsp.buf.implementation()') + bufmap('n', 'grn', 'lua vim.lsp.buf.rename()') + bufmap('n', 'gra', 'lua vim.lsp.buf.code_action()') + bufmap('n', 'gO', 'lua vim.lsp.buf.document_symbol()') + bufmap({'i', 's'}, '', 'lua vim.lsp.buf.signature_help()') + end, + }) + + end +} diff --git a/.config/nvim/lua/plugins/nvim-lspconfig.lua b/.config/nvim/lua/plugins/nvim-lspconfig.lua deleted file mode 100644 index 2d78bee..0000000 --- a/.config/nvim/lua/plugins/nvim-lspconfig.lua +++ /dev/null @@ -1,6 +0,0 @@ --- plugins/telescope.lua: -return { - 'neovim/nvim-lspconfig', - config = function() - end -}