This commit is contained in:
2024-01-24 14:30:44 -05:00
parent 54b784f6ba
commit 0ab89f02ba
8 changed files with 156 additions and 13 deletions

View File

@@ -5,7 +5,7 @@ local lspconfig = require("lspconfig")
-- if you just want default config for the servers then put them in a table
local servers =
{ "html", "cssls", "tsserver", "clangd", "docker_compose_language_service", "dockerls", "rust_analyzer", "pyright" }
{ "html", "cssls", "tsserver", "clangd", "docker_compose_language_service", "dockerls", "rust_analyzer", "pyright", "grammarly" }
for _, lsp in ipairs(servers) do
lspconfig[lsp].setup({

View File

@@ -41,6 +41,7 @@ M.mason = {
"jedi_language_server",
"docker_compose_language_service",
"dockerls",
},
@@ -62,4 +63,58 @@ M.nvimtree = {
},
}
M.cmp = function (_, opts)
local cmp = require "cmp"
opts.experimental = {
ghost_text = true,
}
opts.sources = cmp.config.sources({
{ name = "nvim_lsp" },
{ name = "luasnip" },
{ name = "nvim_lua" },
{ name = "path" },
{ name = "buffer", keyword_length = 5},
})
opts.mapping = cmp.config.mapping {
["<C-p>"] = cmp.mapping.select_prev_item(),
["<C-n>"] = cmp.mapping.select_next_item(),
["<C-d>"] = cmp.mapping.scroll_docs(-4),
["<C-f>"] = cmp.mapping.scroll_docs(4),
["<C-Space>"] = cmp.mapping.complete(),
["<C-e>"] = cmp.mapping.close(),
["<C-y>"] = cmp.mapping.confirm {
behavior = cmp.ConfirmBehavior.Insert,
select = true,
},
["<Tab>"] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_next_item()
elseif require("luasnip").expand_or_jumpable() then
vim.fn.feedkeys(vim.api.nvim_replace_termcodes("<Plug>luasnip-expand-or-jump", true, true, true), "")
else
fallback()
end
end, {
"i",
"s",
}),
["<S-Tab>"] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_prev_item()
elseif require("luasnip").jumpable(-1) then
vim.fn.feedkeys(vim.api.nvim_replace_termcodes("<Plug>luasnip-jump-prev", true, true, true), "")
else
fallback()
end
end, {
"i",
"s",
}),
}
return opts
end
return M