local status_ok, mason = pcall(require, "mason") if not status_ok then return end local status_ok, mason_lspconfig = pcall(require, "mason-lspconfig") if not status_ok then return end local status_ok, lspconfig = pcall(require, "lspconfig") if not status_ok then return end mason.setup() mason_lspconfig.setup() local opts = { noremap = true, silent = true } vim.api.nvim_set_keymap("n", "gD", "lua vim.lsp.buf.declaration()", opts) vim.api.nvim_set_keymap("n", "gd", "lua vim.lsp.buf.definition()", opts) vim.api.nvim_set_keymap("n", "K", "lua vim.lsp.buf.hover()", opts) vim.api.nvim_set_keymap("n", "gi", "lua vim.lsp.buf.implementation()", opts) vim.api.nvim_set_keymap("n", "", "lua vim.lsp.buf.signature_help()", opts) vim.api.nvim_set_keymap("n", "grr", "lua vim.lsp.buf.rename()", opts) vim.api.nvim_set_keymap("n", "gr", "lua vim.lsp.buf.references()", opts) vim.api.nvim_set_keymap("n", "ca", "lua vim.lsp.buf.code_action()", opts) -- vim.api.nvim_buf_set_keymap("n", "f", "lua vim.diagnostic.open_float()", opts) vim.api.nvim_set_keymap("n", "[d", 'lua vim.diagnostic.goto_prev({ border = "rounded" })', opts) vim.api.nvim_set_keymap("n", "gl", 'lua vim.diagnostic.open_float({ border = "rounded" })', opts) vim.api.nvim_set_keymap("n", "]d", 'lua vim.diagnostic.goto_next({ border = "rounded" })', opts) vim.api.nvim_set_keymap("n", "q", "lua vim.diagnostic.setloclist()", opts) vim.cmd([[ command! Format execute 'lua vim.lsp.buf.format{async=true}' ]]) require("user.lsp.mason_lsp_config") require("user.lsp.handlers").setup()