123456789101112131415161718192021222324252627282930313233343536373839404142434445 |
- 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", "<leader>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 = {
- ['<C-b>'] = cmp.mapping.scroll_docs(-4),
- ['<C-f>'] = cmp.mapping.scroll_docs(4),
- ['<C-Space>'] = cmp.mapping.complete(),
- ['<C-e>'] = cmp.mapping.abort(),
- ['<CR>'] = 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' },
- })
- })
|