mirror of
https://github.com/cole-maxwell1/dotfiles.git
synced 2026-06-03 11:10:20 -04:00
Refactor: use vim 0.12 built-in package manager.
- removes lazyvim - updates cmp config
This commit is contained in:
@@ -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"
|
||||
}})
|
||||
})
|
||||
@@ -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")
|
||||
@@ -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
|
||||
}})
|
||||
@@ -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
|
||||
})
|
||||
@@ -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",
|
||||
})
|
||||
Reference in New Issue
Block a user