2024-04-23 04:34:15 +02:00
|
|
|
return {
|
2024-04-29 12:07:37 +02:00
|
|
|
{
|
|
|
|
"VonHeikemen/lsp-zero.nvim",
|
|
|
|
branch = "v3.x",
|
|
|
|
lazy = true,
|
|
|
|
config = false,
|
|
|
|
init = function()
|
|
|
|
vim.g.lsp_zero_extend_cmp = 0
|
|
|
|
vim.g.lsp_zero_extend_lspconfig = 0
|
|
|
|
end,
|
|
|
|
},
|
2024-04-23 04:34:15 +02:00
|
|
|
|
2024-04-29 12:07:37 +02:00
|
|
|
-- autocompletion
|
|
|
|
{
|
|
|
|
"hrsh7th/nvim-cmp",
|
|
|
|
event = "InsertEnter",
|
|
|
|
dependencies = {
|
|
|
|
{ "L3MON4D3/LuaSnip" },
|
|
|
|
{ "hrsh7th/cmp-buffer" },
|
|
|
|
{ "https://codeberg.org/FelipeLema/cmp-async-path" },
|
|
|
|
{ "hrsh7th/cmp-nvim-lsp" },
|
|
|
|
{ "saadparwaiz1/cmp_luasnip" },
|
|
|
|
{ "rafamadriz/friendly-snippets" },
|
|
|
|
{ "onsails/lspkind.nvim" },
|
|
|
|
{ "hrsh7th/cmp-calc" },
|
|
|
|
{ "f3fora/cmp-spell" },
|
|
|
|
{ "micangl/cmp-vimtex" },
|
|
|
|
{ "Jezda1337/nvim-html-css" },
|
|
|
|
},
|
|
|
|
config = function()
|
|
|
|
local lsp_zero = require("lsp-zero")
|
|
|
|
lsp_zero.extend_cmp()
|
2024-04-23 04:34:15 +02:00
|
|
|
|
2024-04-29 12:07:37 +02:00
|
|
|
local cmp = require("cmp")
|
|
|
|
local cmp_action = lsp_zero.cmp_action()
|
2024-04-23 04:34:15 +02:00
|
|
|
|
2024-04-29 12:07:37 +02:00
|
|
|
-- Lazy load snippets from VSCode
|
|
|
|
require("luasnip.loaders.from_vscode").lazy_load()
|
|
|
|
require("luasnip.loaders.from_vscode").lazy_load({ paths = { "./lua/snippets" } })
|
2024-04-23 04:34:15 +02:00
|
|
|
|
2024-04-29 12:07:37 +02:00
|
|
|
cmp.setup({
|
|
|
|
sources = {
|
|
|
|
{ name = "luasnip" },
|
|
|
|
{ name = "nvim_lsp" },
|
|
|
|
{ name = "buffer" },
|
|
|
|
{ name = "async_path" },
|
|
|
|
{ name = "calc" },
|
|
|
|
{ name = "html-css" },
|
|
|
|
{ name = "vimtex" },
|
|
|
|
{
|
|
|
|
name = "spell",
|
|
|
|
option = {
|
|
|
|
keep_all_entries = false,
|
|
|
|
enable_in_context = function()
|
|
|
|
return true
|
|
|
|
end,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
preselect = "item",
|
|
|
|
completion = {
|
|
|
|
completeopt = "menu,menuone,noinsert",
|
|
|
|
},
|
|
|
|
window = {
|
|
|
|
completion = cmp.config.window.bordered(),
|
|
|
|
documentation = cmp.config.window.bordered(),
|
|
|
|
},
|
|
|
|
formatting = {
|
2024-04-23 04:34:15 +02:00
|
|
|
maxwidth = 30,
|
2024-04-29 12:07:37 +02:00
|
|
|
fields = { "abbr", "kind" },
|
|
|
|
format = require("lspkind").cmp_format({
|
|
|
|
mode = "symbol_text",
|
|
|
|
maxwidth = 30,
|
|
|
|
ellipsis_char = "",
|
|
|
|
}),
|
|
|
|
},
|
|
|
|
mapping = cmp.mapping.preset.insert({
|
|
|
|
["<C-Space>"] = cmp.mapping.complete(),
|
|
|
|
["<C-u>"] = cmp.mapping.scroll_docs(-4),
|
|
|
|
["<C-d>"] = cmp.mapping.scroll_docs(4),
|
|
|
|
["<C-f>"] = cmp_action.luasnip_jump_forward(),
|
|
|
|
["<C-b>"] = cmp_action.luasnip_jump_backward(),
|
|
|
|
["<CR>"] = cmp.mapping.confirm({ select = false }),
|
|
|
|
["<Tab>"] = cmp_action.luasnip_supertab(),
|
|
|
|
["<S-Tab>"] = cmp_action.luasnip_shift_supertab(),
|
|
|
|
}),
|
|
|
|
snippet = {
|
|
|
|
expand = function(args)
|
|
|
|
require("luasnip").lsp_expand(args.body)
|
|
|
|
end,
|
|
|
|
},
|
|
|
|
})
|
|
|
|
end,
|
|
|
|
},
|
2024-04-23 04:34:15 +02:00
|
|
|
|
2024-04-29 12:07:37 +02:00
|
|
|
-- lsp
|
|
|
|
{
|
|
|
|
"neovim/nvim-lspconfig",
|
|
|
|
cmd = { "LspInfo", "LspInstall", "LspStart" },
|
|
|
|
event = { "BufReadPre", "BufNewFile" },
|
|
|
|
dependencies = {
|
|
|
|
{
|
|
|
|
"williamboman/mason.nvim",
|
|
|
|
config = true,
|
|
|
|
},
|
|
|
|
{ "hrsh7th/cmp-nvim-lsp" },
|
|
|
|
{ "williamboman/mason-lspconfig.nvim" },
|
|
|
|
},
|
|
|
|
config = function()
|
|
|
|
local lsp_zero = require("lsp-zero")
|
|
|
|
lsp_zero.extend_lspconfig()
|
2024-04-23 04:34:15 +02:00
|
|
|
|
2024-04-29 12:07:37 +02:00
|
|
|
lsp_zero.on_attach(function(client, bufnr)
|
|
|
|
lsp_zero.default_keymaps({
|
|
|
|
buffer = bufnr,
|
|
|
|
-- exclude = { 'gl', 'K' },
|
|
|
|
})
|
|
|
|
end)
|
2024-04-23 04:34:15 +02:00
|
|
|
|
2024-04-29 12:07:37 +02:00
|
|
|
vim.diagnostic.config({
|
|
|
|
underline = false,
|
2024-05-25 17:48:42 +02:00
|
|
|
virtual_text = true,
|
2024-05-21 10:58:35 +02:00
|
|
|
signs = {
|
|
|
|
text = {
|
|
|
|
[vim.diagnostic.severity.ERROR] = "",
|
|
|
|
[vim.diagnostic.severity.WARN] = "",
|
|
|
|
[vim.diagnostic.severity.HINT] = "",
|
|
|
|
[vim.diagnostic.severity.INFO] = ""
|
|
|
|
}
|
|
|
|
},
|
2024-04-29 12:07:37 +02:00
|
|
|
update_in_insert = false,
|
|
|
|
severity_sort = true,
|
|
|
|
})
|
|
|
|
|
2024-06-29 08:48:30 +02:00
|
|
|
-- vim.cmd("hi Keyword gui=italic,bold cterm=italic,bold")
|
|
|
|
vim.cmd("hi Comment gui=italic cterm=italic")
|
|
|
|
vim.api.nvim_set_hl(0, "DiagnosticVirtualTextError", { link = "Comment" })
|
|
|
|
vim.api.nvim_set_hl(0, "DiagnosticVirtualTextInfo", { link = "Comment" })
|
|
|
|
vim.api.nvim_set_hl(0, "DiagnosticVirtualTextWarn", { link = "Comment" })
|
|
|
|
vim.api.nvim_set_hl(0, "DiagnosticVirtualTextHint", { link = "Comment" })
|
|
|
|
|
2024-04-29 12:07:37 +02:00
|
|
|
require("mason-lspconfig").setup({
|
|
|
|
ensure_installed = {
|
|
|
|
"clangd",
|
|
|
|
"ruff_lsp",
|
|
|
|
"marksman",
|
|
|
|
"html",
|
|
|
|
"cssls",
|
|
|
|
"lua_ls",
|
|
|
|
"bashls",
|
|
|
|
"texlab",
|
|
|
|
"jsonls",
|
|
|
|
"eslint",
|
2024-06-29 08:48:30 +02:00
|
|
|
"vtsls",
|
2024-04-29 12:07:37 +02:00
|
|
|
},
|
|
|
|
handlers = {
|
|
|
|
lsp_zero.default_setup,
|
|
|
|
lua_ls = function()
|
|
|
|
require("lspconfig").lua_ls.setup({
|
|
|
|
settings = {
|
|
|
|
Lua = {
|
|
|
|
workspace = { checkThirdParty = false },
|
|
|
|
telemetry = { enable = false },
|
|
|
|
},
|
2024-05-21 10:58:35 +02:00
|
|
|
completion = {
|
|
|
|
callSnippet = 'Replace',
|
|
|
|
},
|
2024-04-29 12:07:37 +02:00
|
|
|
},
|
|
|
|
})
|
|
|
|
end,
|
|
|
|
clangd = function()
|
|
|
|
require("lspconfig").clangd.setup({
|
|
|
|
capabilities = { offsetEncoding = "utf-16" },
|
|
|
|
-- cmd = {
|
|
|
|
-- "clangd",
|
|
|
|
-- "--background-index",
|
|
|
|
-- "--clang-tidy",
|
|
|
|
-- "--header-insertion=iwyu",
|
|
|
|
-- "--completion-style=detailed",
|
|
|
|
-- "--function-arg-placeholders",
|
|
|
|
-- "--fallback-style=llvm",
|
|
|
|
-- },
|
|
|
|
-- init_options = {
|
|
|
|
-- usePlaceholders = true,
|
|
|
|
-- completeUnimported = true,
|
|
|
|
-- clangdFileStatus = true,
|
|
|
|
-- },
|
|
|
|
})
|
|
|
|
end,
|
|
|
|
-- ltex = function()
|
|
|
|
-- require("lspconfig").ltex.setup({
|
|
|
|
-- settings = {
|
|
|
|
-- ltex = {
|
|
|
|
-- language = {"en-US"},
|
|
|
|
-- -- dictionary = {":~/.config/nvim/spell/en.utf-8.add"},
|
|
|
|
-- disabledRules = { ['en-US'] = { 'MORFOLOGIK_RULE_EN_US' } },
|
|
|
|
-- },
|
|
|
|
-- },
|
|
|
|
-- })
|
|
|
|
-- end,
|
2024-06-29 08:48:30 +02:00
|
|
|
vtsls = function()
|
|
|
|
require("lspconfig").vtsls.setup({
|
|
|
|
filetypes = {
|
|
|
|
"javascript",
|
|
|
|
"javascriptreact",
|
|
|
|
"javascript.jsx",
|
|
|
|
"typescript",
|
|
|
|
"typescriptreact",
|
|
|
|
"typescript.tsx",
|
|
|
|
},
|
|
|
|
settings = {
|
|
|
|
complete_function_calls = true,
|
|
|
|
vtsls = {
|
|
|
|
enableMoveToFileCodeAction = true,
|
|
|
|
autoUseWorkspaceTsdk = true,
|
|
|
|
experimental = {
|
|
|
|
completion = {
|
|
|
|
enableServerSideFuzzyMatch = true,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
typescript = {
|
|
|
|
updateImportsOnFileMove = { enabled = "always" },
|
|
|
|
suggest = {
|
|
|
|
completeFunctionCalls = true,
|
|
|
|
},
|
|
|
|
inlayHints = {
|
|
|
|
enumMemberValues = { enabled = true },
|
|
|
|
functionLikeReturnTypes = { enabled = true },
|
|
|
|
parameterNames = { enabled = "literals" },
|
|
|
|
parameterTypes = { enabled = true },
|
|
|
|
propertyDeclarationTypes = { enabled = true },
|
|
|
|
variableTypes = { enabled = false },
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
})
|
|
|
|
end
|
2024-04-29 12:07:37 +02:00
|
|
|
},
|
|
|
|
})
|
|
|
|
end,
|
|
|
|
},
|
2024-04-23 04:34:15 +02:00
|
|
|
}
|