local map = vim.api.nvim_set_keymap local lspc = require "lspconfig" local caps = require("cmp_nvim_lsp").update_capabilities(vim.lsp.protocol.make_client_capabilities()) local lua_runtime_path = vim.split(package.path, ";") table.insert(lua_runtime_path, "lua/?.lua") table.insert(lua_runtime_path, "lua/?/init.lua") lspc.bashls.setup { capabilities = caps } lspc.clangd.setup { capabilities = caps } lspc.cssls.setup { capabilities = caps } lspc.eslint.setup { capabilities = caps } lspc.html.setup { capabilities = caps } lspc.jsonls.setup { capabilities = caps } lspc.rust_analyzer.setup { capabilities = caps } lspc.sumneko_lua.setup { -- paru -S lua-language-server capabilities = caps, settings = { Lua = { runtime = { version = "LuaJIT", path = lua_runtime_path, }, diagnostics = { globals = { "vim" }, }, workspace = { vim.api.nvim_get_runtime_file("", true), }, telemetry = { enable = false, }, }, }, } lspc.taplo.setup { capabilities = caps } lspc.yamlls.setup { capabilities = caps } lspc.zls.setup { capabilities = caps } -- Mappings. local opts = { noremap = true, silent = true } -- See `:help vim.lsp.*` for documentation on any of the below functions map("n", "gd", "lua vim.lsp.buf.definition()", opts) map("n", "K", "lua vim.lsp.buf.hover()", opts) map("n", "", "lua vim.lsp.buf.signature_help()", opts) map("n", "-n", "lua vim.lsp.buf.rename()", opts) map("n", "-a", "lua vim.lsp.buf.code_action()", opts) map("n", "gr", "lua vim.lsp.buf.references()", opts) map("n", "e", "lua vim.diagnostic.open_float()", opts) map("n", "-d", "lua vim.diagnostic.goto_next()", opts) map("n", "-r", "lua vim.lsp.buf.formatting()", opts)