From 32832a8260b33519d43aa9c0ba6b8beb49e7f91d Mon Sep 17 00:00:00 2001 From: cole-maxwell1 Date: Sat, 25 Apr 2026 10:39:16 -0500 Subject: [PATCH] Refactor: use vim 0.12 built-in package manager. - removes lazyvim - updates cmp config --- .config/nvim/.luarc.json | 13 --- .config/nvim/after/plugin/lsp.lua | 46 --------- .config/nvim/after/plugin/nvim-cmp.lua | 11 -- .config/nvim/init.lua | 7 -- .config/nvim/lazy-lock.json | 14 --- .config/nvim/lua/cole/cmp.lua | 44 ++++++++ .config/nvim/lua/cole/init.lua | 6 +- .config/nvim/lua/cole/lazy.lua | 20 ---- .config/nvim/lua/cole/lsp.lua | 137 +++++++++++++++++++++++++ .config/nvim/lua/cole/plugins.lua | 21 ++++ .config/nvim/nvim-pack-lock.json | 61 +++++++++++ 11 files changed, 267 insertions(+), 113 deletions(-) delete mode 100644 .config/nvim/.luarc.json delete mode 100644 .config/nvim/after/plugin/lsp.lua delete mode 100644 .config/nvim/after/plugin/nvim-cmp.lua delete mode 100644 .config/nvim/lazy-lock.json create mode 100644 .config/nvim/lua/cole/cmp.lua delete mode 100644 .config/nvim/lua/cole/lazy.lua create mode 100644 .config/nvim/lua/cole/lsp.lua create mode 100644 .config/nvim/lua/cole/plugins.lua create mode 100644 .config/nvim/nvim-pack-lock.json diff --git a/.config/nvim/.luarc.json b/.config/nvim/.luarc.json deleted file mode 100644 index 154c5b3..0000000 --- a/.config/nvim/.luarc.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "runtime.version": "LuaJIT", - "runtime.path": [ - "lua/?.lua", - "lua/?/init.lua" - ], - "diagnostics.globals": ["vim"], - "workspace.checkThirdParty": false, - "workspace.library": [ - "$VIMRUNTIME", - "./lua" - ] -} diff --git a/.config/nvim/after/plugin/lsp.lua b/.config/nvim/after/plugin/lsp.lua deleted file mode 100644 index 984f1d1..0000000 --- a/.config/nvim/after/plugin/lsp.lua +++ /dev/null @@ -1,46 +0,0 @@ -local lsp_zero = require('lsp-zero') - --- Attach keybindings on LSP connection -local lsp_attach = function(client, bufnr) - lsp_zero.default_keymaps({ - buffer = bufnr - }) -end - -lsp_zero.extend_lspconfig({ - lsp_attach = lsp_attach, - capabilities = require('cmp_nvim_lsp').default_capabilities() -}) - --- Configure diagnostic signs natively for Neovim v0.11+ -vim.diagnostic.config({ - signs = { - text = { - [vim.diagnostic.severity.ERROR] = '✘', - [vim.diagnostic.severity.WARN] = '▲', - [vim.diagnostic.severity.HINT] = '⚑', - [vim.diagnostic.severity.INFO] = '»' - } - } -}) - -require('mason').setup({}) -require('mason-lspconfig').setup({ - ensure_installed = {'lua_ls', 'ts_ls', 'eslint', 'gopls', 'rust_analyzer'}, - handlers = {function(server_name) - -- Map legacy server names to their modern equivalents - if server_name == 'tsserver' then - server_name = 'ts_ls' - end - - -- Verify the server configuration is accessible to prevent indexing errors - local has_config, _ = pcall(function() - return require('lspconfig')[server_name] - end) - if has_config then - require('lspconfig')[server_name].setup({}) - else - vim.notify("LSP configuration not accessible for: " .. server_name, vim.log.levels.WARN) - end - end} -}) diff --git a/.config/nvim/after/plugin/nvim-cmp.lua b/.config/nvim/after/plugin/nvim-cmp.lua deleted file mode 100644 index 49188af..0000000 --- a/.config/nvim/after/plugin/nvim-cmp.lua +++ /dev/null @@ -1,11 +0,0 @@ -local cmp = require('cmp') - -cmp.setup({ - mapping = cmp.mapping.preset.insert({ - [''] = cmp.mapping.confirm({select = false}), - }), - preselect = 'item', - completion = { - completeopt = 'menu,menuone,noinsert' - }, -}) diff --git a/.config/nvim/init.lua b/.config/nvim/init.lua index d76d350..13df586 100644 --- a/.config/nvim/init.lua +++ b/.config/nvim/init.lua @@ -1,8 +1 @@ -local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" -if not vim.loop.fs_stat(lazypath) then - vim.fn.system({"git", "clone", "--filter=blob:none", "https://github.com/folke/lazy.nvim.git", "--branch=stable", - lazypath}) -end -vim.opt.rtp:prepend(lazypath) - require("cole") diff --git a/.config/nvim/lazy-lock.json b/.config/nvim/lazy-lock.json deleted file mode 100644 index dabd75f..0000000 --- a/.config/nvim/lazy-lock.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "LuaSnip": { "branch": "master", "commit": "a62e1083a3cfe8b6b206e7d3d33a51091df25357" }, - "cmp-nvim-lsp": { "branch": "main", "commit": "cbc7b02bb99fae35cb42f514762b89b5126651ef" }, - "flexoki": { "branch": "main", "commit": "c3e2251e813d29d885a7cbbe9808a7af234d845d" }, - "lazy.nvim": { "branch": "main", "commit": "85c7ff3711b730b4030d03144f6db6375044ae82" }, - "lsp-zero.nvim": { "branch": "v3.x", "commit": "77550f2f6cbf0959ef1583d845661af075f3442b" }, - "mason-lspconfig.nvim": { "branch": "main", "commit": "0a3b42c3e503df87aef6d6513e13148381495c3a" }, - "mason.nvim": { "branch": "main", "commit": "12ddd182d9efbdc848b540f16484a583d52da0fb" }, - "nvim-cmp": { "branch": "main", "commit": "a1d504892f2bc56c2e79b65c6faded2fd21f3eca" }, - "nvim-lspconfig": { "branch": "master", "commit": "e146efacbafed3789ac568abcc5a981c5decaa58" }, - "nvim-treesitter": { "branch": "main", "commit": "4916d6592ede8c07973490d9322f187e07dfefac" }, - "plenary.nvim": { "branch": "master", "commit": "74b06c6c75e4eeb3108ec01852001636d85a932b" }, - "telescope.nvim": { "branch": "master", "commit": "d90956833d7c27e73c621a61f20b29fdb7122709" } -} diff --git a/.config/nvim/lua/cole/cmp.lua b/.config/nvim/lua/cole/cmp.lua new file mode 100644 index 0000000..be1ace7 --- /dev/null +++ b/.config/nvim/lua/cole/cmp.lua @@ -0,0 +1,44 @@ +local cmp = require("cmp") +local luasnip = require("luasnip") + +cmp.setup({ + snippet = { + expand = function(args) + luasnip.lsp_expand(args.body) + end + }, + + mapping = cmp.mapping.preset.insert({ + [""] = cmp.mapping.scroll_docs(-4), + [""] = cmp.mapping.scroll_docs(4), + [""] = cmp.mapping.select_prev_item(), + [""] = cmp.mapping.select_next_item(), + [""] = cmp.mapping.complete(), + [""] = cmp.mapping.abort(), + + [""] = cmp.mapping.confirm({ + select = false + }) + }), + + preselect = cmp.PreselectMode.None, + + completion = { + completeopt = "menu,menuone,noinsert,noselect" + }, + + window = { + completion = cmp.config.window.bordered(), + documentation = cmp.config.window.bordered() + }, + + sources = cmp.config.sources({{ + name = "nvim_lsp" + }, { + name = "luasnip" + }, { + name = "path" + }}, {{ + name = "buffer" + }}) +}) diff --git a/.config/nvim/lua/cole/init.lua b/.config/nvim/lua/cole/init.lua index 04140f8..9a1a28c 100644 --- a/.config/nvim/lua/cole/init.lua +++ b/.config/nvim/lua/cole/init.lua @@ -1,4 +1,6 @@ require("cole.remap") -require("cole.lazy") -require("cole.set") +require("cole.plugins") require("cole.filetype") +require("cole.set") +require("cole.cmp") +require("cole.lsp") \ No newline at end of file diff --git a/.config/nvim/lua/cole/lazy.lua b/.config/nvim/lua/cole/lazy.lua deleted file mode 100644 index a3c40cc..0000000 --- a/.config/nvim/lua/cole/lazy.lua +++ /dev/null @@ -1,20 +0,0 @@ -require("lazy").setup({{ - "bluz71/vim-moonfly-colors", - name = "moonfly", - lazy = false, - priority = 1000 -}, { - 'nvim-telescope/telescope.nvim', - tag = '0.1.5', - dependencies = {'nvim-lua/plenary.nvim'} -}, -- Fuzzy finder -{ - 'nvim-treesitter/nvim-treesitter', - build = ':TSUpdate' -}, -- syntax highlighting -{ - 'VonHeikemen/lsp-zero.nvim', - branch = 'v4.x', - dependencies = {{'williamboman/mason.nvim'}, {'williamboman/mason-lspconfig.nvim'}, {'neovim/nvim-lspconfig'}, - {'hrsh7th/nvim-cmp'}, {'hrsh7th/cmp-nvim-lsp'}, {'L3MON4D3/LuaSnip'}} -- LSP support -}}) diff --git a/.config/nvim/lua/cole/lsp.lua b/.config/nvim/lua/cole/lsp.lua new file mode 100644 index 0000000..1b3e8a0 --- /dev/null +++ b/.config/nvim/lua/cole/lsp.lua @@ -0,0 +1,137 @@ +require("mason").setup() + +require("mason-tool-installer").setup({ + ensure_installed = {"lua_ls", "gopls", "ts_ls", "eslint", "rust_analyzer", "jsonls", "bashls", "stylua", "prettier", + "goimports", "shfmt"} +}) + +local capabilities = require("cmp_nvim_lsp").default_capabilities() + +vim.lsp.config("*", { + capabilities = capabilities +}) + +vim.lsp.config("lua_ls", { + settings = { + Lua = { + runtime = { + version = "LuaJIT" + }, + diagnostics = { + globals = {"vim"} + }, + workspace = { + checkThirdParty = false, + library = {vim.env.VIMRUNTIME, "${3rd}/luv/library"} + }, + telemetry = { + enable = false + } + } + } +}) + +vim.lsp.config("gopls", { + settings = { + gopls = { + staticcheck = true, + gofumpt = true, + usePlaceholders = true + } + } +}) + +vim.lsp.config("ts_ls", { + settings = { + typescript = { + inlayHints = { + includeInlayParameterNameHints = "all", + includeInlayFunctionParameterTypeHints = true, + includeInlayVariableTypeHints = true + } + }, + javascript = { + inlayHints = { + includeInlayParameterNameHints = "all", + includeInlayFunctionParameterTypeHints = true, + includeInlayVariableTypeHints = true + } + } + } +}) + +vim.lsp.config("rust_analyzer", { + settings = { + ["rust-analyzer"] = { + cargo = { + allFeatures = true + }, + check = { + command = "clippy" + } + } + } +}) + +require("mason-lspconfig").setup({ + automatic_enable = { + exclude = {"ts_ls"} + } +}) + +vim.lsp.enable("ts_ls") + +vim.diagnostic.config({ + severity_sort = true, + update_in_insert = false, + + float = { + border = "rounded", + source = "if_many" + }, + + underline = true, + + virtual_text = { + spacing = 2, + source = "if_many", + prefix = "●" + }, + + signs = { + text = { + [vim.diagnostic.severity.ERROR] = "E", + [vim.diagnostic.severity.WARN] = "W", + [vim.diagnostic.severity.INFO] = "I", + [vim.diagnostic.severity.HINT] = "H" + } + } +}) + +vim.api.nvim_create_autocmd("LspAttach", { + callback = function(args) + local bufnr = args.buf + + local map = function(mode, lhs, rhs, desc) + vim.keymap.set(mode, lhs, rhs, { + buffer = bufnr, + silent = true, + desc = desc + }) + end + + map("n", "K", vim.lsp.buf.hover, "LSP hover") + map("n", "gd", vim.lsp.buf.definition, "Go to definition") + map("n", "gD", vim.lsp.buf.declaration, "Go to declaration") + map("n", "gi", vim.lsp.buf.implementation, "Go to implementation") + map("n", "gr", vim.lsp.buf.references, "References") + map("n", "rn", vim.lsp.buf.rename, "Rename symbol") + map({"n", "v"}, "ca", vim.lsp.buf.code_action, "Code action") + + map("n", "f", function() + vim.lsp.buf.format({ + async = true + }) + end, "Format buffer") + end +}) diff --git a/.config/nvim/lua/cole/plugins.lua b/.config/nvim/lua/cole/plugins.lua new file mode 100644 index 0000000..7989a8e --- /dev/null +++ b/.config/nvim/lua/cole/plugins.lua @@ -0,0 +1,21 @@ +-- Define plugins for Neovim 0.12 native package manager. +vim.pack.add({ + "https://github.com/bluz71/vim-moonfly-colors", + + "https://github.com/nvim-lua/plenary.nvim", + { src = "https://github.com/nvim-telescope/telescope.nvim", version = "0.1.5" }, + + "https://github.com/nvim-treesitter/nvim-treesitter", + + "https://github.com/mason-org/mason.nvim", + "https://github.com/mason-org/mason-lspconfig.nvim", + "https://github.com/WhoIsSethDaniel/mason-tool-installer.nvim", + "https://github.com/neovim/nvim-lspconfig", + + "https://github.com/hrsh7th/nvim-cmp", + "https://github.com/hrsh7th/cmp-nvim-lsp", + "https://github.com/hrsh7th/cmp-buffer", + "https://github.com/hrsh7th/cmp-path", + "https://github.com/saadparwaiz1/cmp_luasnip", + "https://github.com/L3MON4D3/LuaSnip", +}) \ No newline at end of file diff --git a/.config/nvim/nvim-pack-lock.json b/.config/nvim/nvim-pack-lock.json new file mode 100644 index 0000000..15e70a5 --- /dev/null +++ b/.config/nvim/nvim-pack-lock.json @@ -0,0 +1,61 @@ +{ + "plugins": { + "LuaSnip": { + "rev": "a62e1083a3cfe8b6b206e7d3d33a51091df25357", + "src": "https://github.com/L3MON4D3/LuaSnip" + }, + "cmp-buffer": { + "rev": "b74fab3656eea9de20a9b8116afa3cfc4ec09657", + "src": "https://github.com/hrsh7th/cmp-buffer" + }, + "cmp-nvim-lsp": { + "rev": "cbc7b02bb99fae35cb42f514762b89b5126651ef", + "src": "https://github.com/hrsh7th/cmp-nvim-lsp" + }, + "cmp-path": { + "rev": "c642487086dbd9a93160e1679a1327be111cbc25", + "src": "https://github.com/hrsh7th/cmp-path" + }, + "cmp_luasnip": { + "rev": "98d9cb5c2c38532bd9bdb481067b20fea8f32e90", + "src": "https://github.com/saadparwaiz1/cmp_luasnip" + }, + "mason-lspconfig.nvim": { + "rev": "0c2823e0418f3d9230ff8b201c976e84de1cb401", + "src": "https://github.com/mason-org/mason-lspconfig.nvim" + }, + "mason-tool-installer.nvim": { + "rev": "443f1ef8b5e6bf47045cb2217b6f748a223cf7dc", + "src": "https://github.com/WhoIsSethDaniel/mason-tool-installer.nvim" + }, + "mason.nvim": { + "rev": "12ddd182d9efbdc848b540f16484a583d52da0fb", + "src": "https://github.com/mason-org/mason.nvim" + }, + "nvim-cmp": { + "rev": "a1d504892f2bc56c2e79b65c6faded2fd21f3eca", + "src": "https://github.com/hrsh7th/nvim-cmp" + }, + "nvim-lspconfig": { + "rev": "8fde495949782bb61c2605174e231d145a048d8c", + "src": "https://github.com/neovim/nvim-lspconfig" + }, + "nvim-treesitter": { + "rev": "4916d6592ede8c07973490d9322f187e07dfefac", + "src": "https://github.com/nvim-treesitter/nvim-treesitter" + }, + "plenary.nvim": { + "rev": "74b06c6c75e4eeb3108ec01852001636d85a932b", + "src": "https://github.com/nvim-lua/plenary.nvim" + }, + "telescope.nvim": { + "rev": "d90956833d7c27e73c621a61f20b29fdb7122709", + "src": "https://github.com/nvim-telescope/telescope.nvim", + "version": "'0.1.5'" + }, + "vim-moonfly-colors": { + "rev": "ed33cb0e0edfced6e86e782d51f23e67232ad4a9", + "src": "https://github.com/bluz71/vim-moonfly-colors" + } + } +}