local lsp_zero = require('lsp-zero') lsp_zero.on_attach(function(client, bufnr) lsp_zero.default_keymaps({buffer = bufnr}) -- rename symbol vim.keymap.set('', '', vim.lsp.buf.rename, {noremap = true}) -- tab completion lsp_zero.extend_cmp() local cmp = require('cmp') cmp.setup({ mapping = cmp.mapping.preset.insert({ [''] = cmp.mapping.complete(), [''] = cmp.mapping( function(fallback) if cmp.visible() then if #cmp.get_entries() == 1 then cmp.confirm({ select = true }) else cmp.select_next_item() end else fallback() end end, { 'i', 's' } ), [''] = cmp.mapping.select_prev_item(), [''] = cmp.mapping.confirm({ select = true }), -- [''] = cmp.mapping.abort(), [''] = cmp.mapping.scroll_docs(-4), [''] = cmp.mapping.scroll_docs(4), }), }) -- inlay hints vim.lsp.inlay_hint.enable(true) -- signature help require('lsp_signature').on_attach({ floating_window_above_cur_line = true }, bufnr) -- auto-format -- vim.api.nvim_create_autocmd('BufWritePre', { -- callback = vim.lsp.buf.format, -- }) end) local lsp_config = require('lspconfig') lsp_config['clangd'].setup({}) lsp_config['rust_analyzer'].setup({}) lsp_config['texlab'].setup({}) lsp_config['pylsp'].setup({})