local nvim_lsp = require "lspconfig" local protocol = require "vim.lsp.protocol" -- Set up lspconfig. local capabilities = require('cmp_nvim_lsp').update_capabilities(vim.lsp.protocol.make_client_capabilities()) --- the on-attach function that is called for all Language Servers local on_attach = function(client, bufnr) vim.keymap.set("n", "K", vim.lsp.buf.hover, {buffer = 0}) vim.keymap.set("n", "gd", vim.lsp.buf.definition, {buffer = 0}) vim.keymap.set("n", "gt", vim.lsp.buf.type_definition, {buffer = 0}) vim.keymap.set("n", "gi", vim.lsp.buf.implementation, {buffer = 0}) vim.keymap.set("n", "r", vim.lsp.buf.rename, {buffer = 0}) end require('lspconfig')['pylsp'].setup { on_attach= on_attach, capabilities = capabilities } require('lspconfig')['nimls'].setup { on_attach= on_attach, capabilities = capabilities } --- Completion Stuff vim.opt.completeopt={"menu", "menuone", "noinsert" ,"noselect"} local cmp = require'cmp' cmp.setup({ mapping = { [''] = cmp.mapping.scroll_docs(-4), [''] = cmp.mapping.scroll_docs(4), [''] = cmp.mapping.complete(), [''] = cmp.mapping.abort(), [''] = cmp.mapping.confirm({ select = true }), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items. }, sources = cmp.config.sources({ { name = 'nvim_lsp' }, }) })