" from: https://sharksforarms.dev/posts/neovim-rust/ " Set completeopt to have a better completion experience " :help completeopt " menuone: popup even when there's only one match " noinsert: Do not insert text until a selection is made " noselect: Do not select, force user to select one from the menu set completeopt=menuone,noinsert,noselect " Avoid showing extra messages when using completion set shortmess+=c " Configure LSP through rust-tools.nvim plugin. " rust-tools will configure and enable certain LSP features for us. " See https://github.com/simrat39/rust-tools.nvim#configuration lua <", rt.hover_actions.hover_actions, { buffer = bufnr}) -- Code action groups vim.keymap.set("n", "a>", rt.code_action_group.code_action_group, { buffer = bufnr}) end }, }, -- rust-analyer options }) EOF " Setup Completion " See https://github.com/hrsh7th/nvim-cmp#basic-configuration lua <'] = cmp.mapping.select_prev_item(), [''] = cmp.mapping.select_next_item(), -- Add tab support [''] = 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.Insert, select = true, }) }, -- Installed sources sources = { { name = 'nvim_lsp' }, { name = 'vsnip' }, { name = 'path' }, { name = 'buffer' }, }, }) EOF " Set updatetime for CursorHold " 300ms of no cursor movement to trigger CursorHold set updatetime=750 " Show diagnostic popup on cursor hold autocmd CursorHold * lua vim.diagnostic.open_float() " have a fixed column for the diagnostics to appear in " this removes the jitter when warnings/errors flow in set signcolumn=yes let g:LanguageClient_serverCommands = { \ 'rust': ['rust-analyzer'], \ } lua<