From 99ae247eacf35697c607d880675d910fcce90ae3 Mon Sep 17 00:00:00 2001 From: Daniel Weipert Date: Mon, 6 Nov 2023 15:54:24 +0100 Subject: [nvim] refactor plugins to use lazy.nvim --- .config/nvim/plugins/lsp.vim | 91 -------------------------------------------- 1 file changed, 91 deletions(-) delete mode 100644 .config/nvim/plugins/lsp.vim (limited to '.config/nvim/plugins/lsp.vim') diff --git a/.config/nvim/plugins/lsp.vim b/.config/nvim/plugins/lsp.vim deleted file mode 100644 index d0f6f26..0000000 --- a/.config/nvim/plugins/lsp.vim +++ /dev/null @@ -1,91 +0,0 @@ -lua < - buf_set_option('omnifunc', 'v:lua.vim.lsp.omnifunc') - - -- Mappings. - local opts = { noremap=true, silent=true } - - -- See :help vim.lsp.* for documentation on any of the below functions - buf_set_keymap('n', 'gD', 'lua vim.lsp.buf.declaration()', opts) - buf_set_keymap('n', 'gd', 'lua vim.lsp.buf.definition()', opts) - buf_set_keymap('n', 'K', 'lua vim.lsp.buf.hover()', opts) - buf_set_keymap('n', 'gi', 'lua vim.lsp.buf.implementation()', opts) - buf_set_keymap('n', '', 'lua vim.lsp.buf.signature_help()', opts) - buf_set_keymap('n', 'wa', 'lua vim.lsp.buf.add_workspace_folder()', opts) - buf_set_keymap('n', 'wr', 'lua vim.lsp.buf.remove_workspace_folder()', opts) - buf_set_keymap('n', 'wl', 'lua print(vim.inspect(vim.lsp.buf.list_workspace_folders()))', opts) - buf_set_keymap('n', 'D', 'lua vim.lsp.buf.type_definition()', opts) - buf_set_keymap('n', 'rn', 'lua vim.lsp.buf.rename()', opts) - buf_set_keymap('n', 'ca', 'lua vim.lsp.buf.code_action()', opts) - buf_set_keymap('n', 'gr', 'lua vim.lsp.buf.references()', opts) - buf_set_keymap('n', 'e', 'lua vim.diagnostic.open_float()', opts) - buf_set_keymap('n', '[d', 'lua vim.diagnostic.goto_prev()', opts) - buf_set_keymap('n', ']d', 'lua vim.diagnostic.goto_next()', opts) - buf_set_keymap('n', 'q', 'lua vim.diagnostic.setloclist()', opts) - buf_set_keymap('n', 'f', 'lua vim.lsp.buf.format({async = true})', opts) -end - -local capabilities = vim.lsp.protocol.make_client_capabilities() -capabilities = require('cmp_nvim_lsp').default_capabilities(capabilities) - -vim.o.completeopt = 'menuone,noselect' - -require('mason').setup() -require('mason-lspconfig').setup() -require('mason-lspconfig').setup_handlers { - function (server_name) - require ('lspconfig')[server_name].setup { - on_attach = on_attach, - capabilities = capabilities, - } - end -} - -local cmp = require('cmp') -local luasnip = require('luasnip') -cmp.setup { - snippet = { - expand = function(args) - luasnip.lsp_expand(args.body) - end, - }, - mapping = { - [''] = cmp.mapping.select_prev_item(), - [''] = cmp.mapping.select_next_item(), - [''] = cmp.mapping.scroll_docs(-4), - [''] = cmp.mapping.scroll_docs(4), - [''] = cmp.mapping.complete(), - [''] = cmp.mapping.close(), - [''] = cmp.mapping.confirm { - behavior = cmp.ConfirmBehavior.Replace, - select = true, - }, - [''] = function(fallback) - if cmp.visible() then - cmp.select_next_item() - elseif luasnip.expand_or_jumpable() then - luasnip.expand_or_jump() - else - fallback() - end - end, - [''] = function(fallback) - if cmp.visible() then - cmp.select_prev_item() - elseif luasnip.jumpable(-1) then - luasnip.jump(-1) - else - fallback() - end - end, - }, - sources = { - { name = 'nvim_lsp' }, - { name = 'luasnip' }, - }, -} -EOF -- cgit v1.2.3