refactor(nvim): modernize plugin stack
Removed dead weight: - Drop nightfox, rose-pine, kanagawa, everforest colorschemes - Remove fzf/fzf.vim (redundant with telescope) - Remove vim-fugitive and its keymaps (lazygit covers this) - Remove Comment.nvim (built into nvim 0.10+) Replaced: - nvim-cmp → blink.cmp (Rust-powered, faster, ghost text) - none-ls/null-ls → conform.nvim (async, maintained) - cmp-nvim-lsp capabilities → blink.cmp.get_lsp_capabilities() - Copilot suggestions now routed through blink-copilot Added: - lazydev.nvim for proper Lua LSP in nvim config - flash.nvim (s/S jump anywhere on screen) - which-key.nvim (leader key popup with groups) - snacks.nvim (notifier + word highlights) - nvim-treesitter-textobjects (af/if, ac/ic, ]f/[f) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -1,12 +1,23 @@
|
||||
-- ~/.config/nvim/lua/plugins/lsp.lua
|
||||
return {
|
||||
-- Lazydev: proper Lua LSP for neovim config files
|
||||
{
|
||||
"folke/lazydev.nvim",
|
||||
ft = "lua",
|
||||
opts = {
|
||||
library = {
|
||||
{ path = "luvit-meta/library", words = { "vim%.uv" } },
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
-- Mason (LSP installer)
|
||||
{
|
||||
"williamboman/mason.nvim",
|
||||
build = ":MasonUpdate",
|
||||
opts = {},
|
||||
},
|
||||
|
||||
|
||||
-- Mason LSP config integration
|
||||
{
|
||||
"williamboman/mason-lspconfig.nvim",
|
||||
@@ -15,19 +26,19 @@ return {
|
||||
ensure_installed = { "lua_ls", "pyright", "texlab", "bashls", "marksman" },
|
||||
},
|
||||
},
|
||||
|
||||
|
||||
-- LSP configuration
|
||||
{
|
||||
"neovim/nvim-lspconfig",
|
||||
dependencies = {
|
||||
dependencies = {
|
||||
"mason.nvim",
|
||||
"mason-lspconfig.nvim",
|
||||
"hrsh7th/cmp-nvim-lsp",
|
||||
"saghen/blink.cmp",
|
||||
},
|
||||
config = function()
|
||||
local lspconfig = require("lspconfig")
|
||||
local capabilities = require("cmp_nvim_lsp").default_capabilities()
|
||||
|
||||
local capabilities = require("blink.cmp").get_lsp_capabilities()
|
||||
local servers = { "lua_ls", "pyright", "texlab", "bashls", "marksman" }
|
||||
|
||||
-- Configure diagnostics to be hidden by default
|
||||
vim.diagnostic.config({
|
||||
virtual_text = false,
|
||||
@@ -36,7 +47,7 @@ return {
|
||||
update_in_insert = false,
|
||||
severity_sort = false,
|
||||
})
|
||||
|
||||
|
||||
-- Set up keymaps for LSP
|
||||
vim.api.nvim_create_autocmd("LspAttach", {
|
||||
group = vim.api.nvim_create_augroup("UserLspConfig", {}),
|
||||
@@ -51,86 +62,80 @@ return {
|
||||
vim.keymap.set('n', ']d', vim.diagnostic.goto_next, opts)
|
||||
end,
|
||||
})
|
||||
|
||||
-- Language servers setup with capabilities
|
||||
lspconfig.lua_ls.setup({
|
||||
capabilities = capabilities,
|
||||
})
|
||||
lspconfig.pyright.setup({
|
||||
capabilities = capabilities,
|
||||
})
|
||||
lspconfig.texlab.setup({
|
||||
capabilities = capabilities,
|
||||
})
|
||||
lspconfig.bashls.setup({
|
||||
capabilities = capabilities,
|
||||
})
|
||||
lspconfig.marksman.setup({
|
||||
capabilities = capabilities,
|
||||
})
|
||||
|
||||
-- Use Neovim 0.11+ LSP API to avoid deprecated lspconfig setup calls.
|
||||
if vim.lsp.config and vim.lsp.enable then
|
||||
for _, server in ipairs(servers) do
|
||||
vim.lsp.config(server, { capabilities = capabilities })
|
||||
end
|
||||
vim.lsp.enable(servers)
|
||||
else
|
||||
local lspconfig = require("lspconfig")
|
||||
for _, server in ipairs(servers) do
|
||||
lspconfig[server].setup({ capabilities = capabilities })
|
||||
end
|
||||
end
|
||||
end,
|
||||
},
|
||||
|
||||
-- Completion
|
||||
|
||||
-- Copilot (suggestion/panel disabled — blink-copilot handles completions)
|
||||
{
|
||||
"hrsh7th/nvim-cmp",
|
||||
"zbirenbaum/copilot.lua",
|
||||
event = "InsertEnter",
|
||||
opts = {
|
||||
suggestion = { enabled = false },
|
||||
panel = { enabled = false },
|
||||
},
|
||||
},
|
||||
|
||||
-- blink.cmp: fast Rust-powered completion engine
|
||||
{
|
||||
"saghen/blink.cmp",
|
||||
version = "*",
|
||||
dependencies = {
|
||||
"hrsh7th/cmp-buffer",
|
||||
"hrsh7th/cmp-path",
|
||||
"hrsh7th/cmp-nvim-lsp",
|
||||
"hrsh7th/cmp-nvim-lua",
|
||||
"saadparwaiz1/cmp_luasnip",
|
||||
"rafamadriz/friendly-snippets",
|
||||
{
|
||||
"L3MON4D3/LuaSnip",
|
||||
dependencies = { "rafamadriz/friendly-snippets", "evesdropper/luasnip-latex-snippets.nvim" },
|
||||
build = "make install_jsregexp",
|
||||
dependencies = { "evesdropper/luasnip-latex-snippets.nvim" },
|
||||
config = function()
|
||||
require("luasnip.loaders.from_vscode").lazy_load()
|
||||
require("luasnip.loaders.from_lua").load({ paths = "~/.config/nvim/lua/snippets" })
|
||||
end,
|
||||
},
|
||||
{
|
||||
"fmuaddel/blink-copilot",
|
||||
dependencies = { "zbirenbaum/copilot.lua" },
|
||||
},
|
||||
},
|
||||
config = function()
|
||||
local cmp = require("cmp")
|
||||
local luasnip = require("luasnip")
|
||||
|
||||
-- Load snippets
|
||||
require("luasnip.loaders.from_vscode").lazy_load()
|
||||
require("luasnip.loaders.from_lua").load({ paths = "~/.config/nvim/lua/snippets" })
|
||||
|
||||
cmp.setup({
|
||||
snippet = {
|
||||
expand = function(args)
|
||||
luasnip.lsp_expand(args.body)
|
||||
end,
|
||||
opts = {
|
||||
keymap = {
|
||||
preset = "default",
|
||||
["<Tab>"] = { "select_next", "snippet_forward", "fallback" },
|
||||
["<S-Tab>"] = { "select_prev", "snippet_backward", "fallback" },
|
||||
["<CR>"] = { "accept", "fallback" },
|
||||
},
|
||||
appearance = { nerd_font_variant = "mono" },
|
||||
sources = {
|
||||
default = { "lazydev", "lsp", "path", "snippets", "buffer", "copilot" },
|
||||
providers = {
|
||||
lazydev = {
|
||||
name = "LazyDev",
|
||||
module = "lazydev.integrations.blink",
|
||||
score_offset = 100,
|
||||
},
|
||||
copilot = {
|
||||
name = "copilot",
|
||||
module = "blink-copilot",
|
||||
score_offset = 50,
|
||||
async = true,
|
||||
},
|
||||
},
|
||||
mapping = cmp.mapping.preset.insert({
|
||||
["<C-Space>"] = cmp.mapping.complete(),
|
||||
["<CR>"] = cmp.mapping.confirm({ select = true }),
|
||||
["<Tab>"] = cmp.mapping(function(fallback)
|
||||
if require("copilot.suggestion").is_visible() then
|
||||
require("copilot.suggestion").accept()
|
||||
elseif cmp.visible() then
|
||||
cmp.select_next_item()
|
||||
elseif luasnip.expand_or_jumpable() then
|
||||
luasnip.expand_or_jump()
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
end, { "i", "s" }),
|
||||
["<S-Tab>"] = cmp.mapping(function(fallback)
|
||||
if cmp.visible() then
|
||||
cmp.select_prev_item()
|
||||
elseif luasnip.jumpable(-1) then
|
||||
luasnip.jump(-1)
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
end, { "i", "s" }),
|
||||
}),
|
||||
sources = cmp.config.sources({
|
||||
{ name = "nvim_lsp" },
|
||||
{ name = "luasnip" },
|
||||
{ name = "buffer" },
|
||||
{ name = "path" },
|
||||
}),
|
||||
})
|
||||
end,
|
||||
},
|
||||
snippets = { preset = "luasnip" },
|
||||
completion = {
|
||||
ghost_text = { enabled = true },
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user