update
This commit is contained in:
parent
a0049b8e06
commit
ed3cabf8b0
6 changed files with 119 additions and 8 deletions
39
lua/plugins/cmp.lua
Normal file
39
lua/plugins/cmp.lua
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
return {
|
||||
"hrsh7th/nvim-cmp",
|
||||
event = "InsertEnter",
|
||||
dependencies = {
|
||||
"hrsh7th/cmp-nvim-lsp",
|
||||
"hrsh7th/cmp-buffer",
|
||||
"hrsh7th/cmp-path",
|
||||
"L3MON4D3/LuaSnip",
|
||||
},
|
||||
opts = function()
|
||||
local cmp = require("cmp")
|
||||
local luasnip = require("luasnip")
|
||||
|
||||
return {
|
||||
snippet = {
|
||||
expand = function(args)
|
||||
luasnip.lsp_expand(args.body)
|
||||
end,
|
||||
},
|
||||
mapping = cmp.mapping.preset.insert({
|
||||
["<C-Space>"] = cmp.mapping.complete(),
|
||||
["<CR>"] = cmp.mapping.confirm({ select = false }),
|
||||
["<C-n>"] = cmp.mapping.select_next_item(),
|
||||
["<C-p>"] = cmp.mapping.select_prev_item(),
|
||||
["<C-e>"] = cmp.mapping.abort(),
|
||||
}),
|
||||
sources = cmp.config.sources({
|
||||
{ name = "nvim_lsp" },
|
||||
{ name = "path" },
|
||||
{ name = "buffer" },
|
||||
}),
|
||||
completion = { completeopt = "menu,menuone,noselect" },
|
||||
}
|
||||
end,
|
||||
config = function(_, opts)
|
||||
require("cmp").setup(opts)
|
||||
end,
|
||||
}
|
||||
|
||||
36
lua/plugins/lsp.lua
Normal file
36
lua/plugins/lsp.lua
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
return {
|
||||
"neovim/nvim-lspconfig",
|
||||
event = { "BufReadPre", "BufNewFile" },
|
||||
dependencies = {
|
||||
"folke/neoconf.nvim",
|
||||
"hrsh7th/cmp-nvim-lsp",
|
||||
},
|
||||
config = function()
|
||||
local capabilities = require("cmp_nvim_lsp").default_capabilities()
|
||||
|
||||
local servers = {
|
||||
lua_ls = {
|
||||
settings = {
|
||||
Lua = {
|
||||
diagnostics = { globals = { "vim" } },
|
||||
},
|
||||
},
|
||||
},
|
||||
ts_ls = {},
|
||||
html = {},
|
||||
cssls = {},
|
||||
jsonls = {},
|
||||
bashls = {},
|
||||
marksman = {},
|
||||
intelephense = {},
|
||||
}
|
||||
|
||||
for name, opts in pairs(servers) do
|
||||
local ok, mod = pcall(require, "lspconfig." .. name)
|
||||
if ok and mod and type(mod.setup) == "function" then
|
||||
opts = vim.tbl_deep_extend("force", { capabilities = capabilities }, opts or {})
|
||||
mod.setup(opts)
|
||||
end
|
||||
end
|
||||
end,
|
||||
}
|
||||
10
lua/plugins/neoconf.lua
Normal file
10
lua/plugins/neoconf.lua
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
return {
|
||||
"folke/neoconf.nvim",
|
||||
lazy = false, -- load early so it can influence lspconfig later
|
||||
priority = 1000,
|
||||
opts = {},
|
||||
config = function(_, opts)
|
||||
require("neoconf").setup(opts)
|
||||
end,
|
||||
}
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue