Remove mason, cmp luasnip and lsp related stuff, added blink and nvim/lspconfig
This commit is contained in:
8
lua/plugins/blink.lua
Normal file
8
lua/plugins/blink.lua
Normal file
@@ -0,0 +1,8 @@
|
||||
return {
|
||||
"saghen/blink.cmp",
|
||||
dependecies = { "rafamadriz/friendly-snippets" },
|
||||
version = "1.*",
|
||||
opts = {
|
||||
keymap = { preset = "enter" }
|
||||
}
|
||||
}
|
||||
@@ -1,48 +0,0 @@
|
||||
return {
|
||||
{
|
||||
"hrsh7th/cmp-nvim-lsp"
|
||||
},
|
||||
{
|
||||
"L3MON4D3/LuaSnip",
|
||||
version = "v2.*", -- Replace <CurrentMajor> by the latest released major (first number of latest release)
|
||||
-- install jsregexp (optional!).
|
||||
build = "make install_jsregexp",
|
||||
dependencies = {
|
||||
"saadparwaiz1/cmp_luasnip",
|
||||
"rafamadriz/friendly-snippets",
|
||||
},
|
||||
},
|
||||
{
|
||||
"hrsh7th/nvim-cmp",
|
||||
config = function()
|
||||
local cmp = require("cmp")
|
||||
require("luasnip.loaders.from_vscode").lazy_load()
|
||||
|
||||
cmp.setup({
|
||||
snippet = {
|
||||
-- REQUIRED - you must specify a snippet engine
|
||||
expand = function(args)
|
||||
require("luasnip").lsp_expand(args.body) -- For `luasnip` users.
|
||||
end,
|
||||
},
|
||||
window = {
|
||||
completion = cmp.config.window.bordered(),
|
||||
documentation = cmp.config.window.bordered(),
|
||||
},
|
||||
mapping = cmp.mapping.preset.insert({
|
||||
["<C-b>"] = cmp.mapping.scroll_docs(-4),
|
||||
["<C-f>"] = cmp.mapping.scroll_docs(4),
|
||||
["<C-Space>"] = cmp.mapping.complete(),
|
||||
["<C-e>"] = cmp.mapping.abort(),
|
||||
["<CR>"] = cmp.mapping.confirm({ select = true }), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items.
|
||||
}),
|
||||
sources = cmp.config.sources({
|
||||
{ name = "nvim_lsp" },
|
||||
{ name = "luasnip" }, -- For luasnip users.
|
||||
}, {
|
||||
{ name = "buffer" },
|
||||
}),
|
||||
})
|
||||
end,
|
||||
},
|
||||
}
|
||||
@@ -1,71 +0,0 @@
|
||||
return {
|
||||
"neovim/nvim-lspconfig",
|
||||
dependencies = {
|
||||
"mason-org/mason.nvim",
|
||||
"mason-org/mason-lspconfig.nvim",
|
||||
{
|
||||
"folke/lazydev.nvim",
|
||||
ft = "lua", -- only load on lua files
|
||||
opts = {
|
||||
library = {
|
||||
-- See the configuration section for more details
|
||||
-- Load luvit types when the `vim.uv` word is found
|
||||
{ path = "${3rd}/luv/library", words = { "vim%.uv" } },
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
config = function()
|
||||
local capabilities = require("cmp_nvim_lsp").default_capabilities()
|
||||
local handlers = {
|
||||
-- ["textDocument/hover"] = vim.lsp.with(vim.lsp.handlers.hover, { border = "rounded" }),
|
||||
-- ["textDocument/signatureHelp"] = vim.lsp.with(vim.lsp.handlers.signature_help, { border = "rounded" }),
|
||||
}
|
||||
|
||||
require("mason").setup()
|
||||
require("mason-lspconfig").setup({
|
||||
ensure_installed = {
|
||||
"lua_ls",
|
||||
"gopls",
|
||||
"html",
|
||||
"basedpyright",
|
||||
"clangd",
|
||||
"yamlls",
|
||||
"ansiblels",
|
||||
},
|
||||
handlers = {
|
||||
function(server_name)
|
||||
require("lspconfig")[server_name].setup {
|
||||
capabilities = capabilities,
|
||||
handlers = handlers
|
||||
}
|
||||
end,
|
||||
clangd = function()
|
||||
local lspconfig = require("lspconfig")
|
||||
lspconfig.clangd.setup({
|
||||
capabilities = capabilities,
|
||||
handlers = handlers,
|
||||
init_options = {
|
||||
fallbackFlags = { '--std=c++20' }
|
||||
},
|
||||
})
|
||||
end,
|
||||
}
|
||||
})
|
||||
|
||||
vim.api.nvim_create_autocmd("LspAttach", {
|
||||
group = vim.api.nvim_create_augroup("lsp", { clear = true }),
|
||||
callback = function(args)
|
||||
-- 2
|
||||
vim.api.nvim_create_autocmd("BufWritePre", {
|
||||
-- 3
|
||||
buffer = args.buf,
|
||||
callback = function()
|
||||
-- 4 + 5
|
||||
vim.lsp.buf.format { async = false, id = args.data.client_id }
|
||||
end,
|
||||
})
|
||||
end
|
||||
})
|
||||
end,
|
||||
}
|
||||
21
lua/plugins/lsp.lua
Normal file
21
lua/plugins/lsp.lua
Normal file
@@ -0,0 +1,21 @@
|
||||
return {
|
||||
"neovim/nvim-lspconfig",
|
||||
config = function()
|
||||
vim.lsp.enable({ "lua_ls", "basedpyright", "gopls", "html", "yamlls", "svelte-language-server", "clangd", "ansiblels" })
|
||||
|
||||
vim.api.nvim_create_autocmd("LspAttach", {
|
||||
group = vim.api.nvim_create_augroup("lsp", { clear = true }),
|
||||
callback = function(args)
|
||||
-- 2
|
||||
vim.api.nvim_create_autocmd("BufWritePre", {
|
||||
-- 3
|
||||
buffer = args.buf,
|
||||
callback = function()
|
||||
-- 4 + 5
|
||||
vim.lsp.buf.format { async = false, id = args.data.client_id }
|
||||
end,
|
||||
})
|
||||
end
|
||||
})
|
||||
end
|
||||
}
|
||||
@@ -8,4 +8,4 @@ return {
|
||||
}
|
||||
})
|
||||
end
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,14 +0,0 @@
|
||||
return {
|
||||
"nvimtools/none-ls.nvim",
|
||||
config = function()
|
||||
local null_ls = require("null-ls")
|
||||
null_ls.setup({
|
||||
sources = {
|
||||
null_ls.builtins.formatting.stylua,
|
||||
null_ls.builtins.formatting.gofmt,
|
||||
null_ls.builtins.formatting.prettierd,
|
||||
null_ls.builtins.formatting.black
|
||||
},
|
||||
})
|
||||
end,
|
||||
}
|
||||
11
lua/plugins/vim-lazy-dev.lua
Normal file
11
lua/plugins/vim-lazy-dev.lua
Normal file
@@ -0,0 +1,11 @@
|
||||
return {
|
||||
"folke/lazydev.nvim",
|
||||
ft = "lua", -- only load on lua files
|
||||
opts = {
|
||||
library = {
|
||||
-- See the configuration section for more details
|
||||
-- Load luvit types when the `vim.uv` word is found
|
||||
{ path = "${3rd}/luv/library", words = { "vim%.uv" } },
|
||||
},
|
||||
},
|
||||
}
|
||||
Reference in New Issue
Block a user