Refactor: use vim 0.12 built-in package manager.

- removes lazyvim
- updates cmp config
This commit is contained in:
2026-04-25 10:39:16 -05:00
parent 3d16375b54
commit 32832a8260
11 changed files with 267 additions and 113 deletions
-13
View File
@@ -1,13 +0,0 @@
{
"runtime.version": "LuaJIT",
"runtime.path": [
"lua/?.lua",
"lua/?/init.lua"
],
"diagnostics.globals": ["vim"],
"workspace.checkThirdParty": false,
"workspace.library": [
"$VIMRUNTIME",
"./lua"
]
}
-46
View File
@@ -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}
})
-11
View File
@@ -1,11 +0,0 @@
local cmp = require('cmp')
cmp.setup({
mapping = cmp.mapping.preset.insert({
['<CR>'] = cmp.mapping.confirm({select = false}),
}),
preselect = 'item',
completion = {
completeopt = 'menu,menuone,noinsert'
},
})
-7
View File
@@ -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")
-14
View File
@@ -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" }
}
+44
View File
@@ -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({
["<C-b>"] = cmp.mapping.scroll_docs(-4),
["<C-f>"] = cmp.mapping.scroll_docs(4),
["<C-p>"] = cmp.mapping.select_prev_item(),
["<C-n>"] = cmp.mapping.select_next_item(),
["<C-Space>"] = cmp.mapping.complete(),
["<C-e>"] = cmp.mapping.abort(),
["<CR>"] = 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"
}})
})
+4 -2
View File
@@ -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")
-20
View File
@@ -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
}})
+137
View File
@@ -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", "<leader>rn", vim.lsp.buf.rename, "Rename symbol")
map({"n", "v"}, "<leader>ca", vim.lsp.buf.code_action, "Code action")
map("n", "<leader>f", function()
vim.lsp.buf.format({
async = true
})
end, "Format buffer")
end
})
+21
View File
@@ -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",
})
+61
View File
@@ -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"
}
}
}