-- settings erro signs local function sign_define(args) vim.fn.sign_define(args.name, { texthl = args.name, text = args.text, numhl = "", }) end sign_define({ name = "DiagnosticSignError", text = "E" }) sign_define({ name = "DiagnosticSignWarn", text = "W" }) sign_define({ name = "DiagnosticSignHint", text = "H" }) sign_define({ name = "DiagnosticSignInfo", text = "I" }) -- diagnostic's aren't lsp dependent vim.keymap.set("n", "vd", function() vim.diagnostic.open_float() end) vim.keymap.set("n", "[d", function() vim.diagnostic.goto_next() end) vim.keymap.set("n", "]d", function() vim.diagnostic.goto_prev() end) -- lsp capabilites enabler vim.api.nvim_create_autocmd("LspAttach", { desc = "LSP Actions", callback = function(event) -- Enable omnifunc vim.bo[event.buf].omnifunc = "v:lua.MiniCompletion.completefunc_lsp" -- Buffer local mappings local opts = { buffer = event.buf } vim.keymap.set("n", "K", function() vim.lsp.buf.hover() end, opts) vim.keymap.set("n", "gd", function() vim.lsp.buf.definition() end, opts) vim.keymap.set("n", "gD", function() vim.lsp.buf.declaration() end, opts) vim.keymap.set("n", "gi", function() vim.lsp.buf.implementation() end, opts) vim.keymap.set("n", "lca", function() vim.lsp.buf.code_action() end, opts) vim.keymap.set("n", "lrn", function() vim.lsp.buf.rename() end, opts) vim.keymap.set("i", "", function() vim.lsp.buf.signature_help() end, opts) end, }) -- setup mason and automatically install some language server's require("mason").setup({}) require("mason-lspconfig").setup({ ensure_installed = { "lua_ls", "jsonls", "bashls", "pyright", "marksman", "gopls", "clangd" }, }) -- automatically setup already installed lsp's require("mason-lspconfig").setup_handlers({ function(server_name) require("lspconfig")[server_name].setup({}) end, }) -- setup haskell language server manually cause it doesn't work with mason for xmonad require("lspconfig").hls.setup({}) -- autocompletion using mini.completion require("mini.completion").setup({ lsp_completion = { source_func = "omnifunc", auto_setup = false, }, fallback_action = "", }) -- bind ctrl j and k to move beetwen completion items vim.keymap.set("i", "", [[pumvisible() ? "\" : "\"]], { expr = true }) vim.keymap.set("i", "", [[pumvisible() ? "\" : "\"]], { expr = true })