DEV Community

Cover image for VIM auto-completion with coc.nvim

VIM auto-completion with coc.nvim

rajikaimal profile image Rajika Imal ・2 min read

VIM is a modal text editor which gives bare minimal setup for text editing. However it's highly flexible and configurable with plugins. With few configurations, we can make VIM similar to VSCode. First you need to install a plugin managers. There are a bunch of plugin managers,

Installing any of the above managers is a straight forward task. After installing a plugin manager we are good to go 👏

Next up installing coc.nvim. Coc is an intellisense engine for VIM. (same as in VSCode) This uses language server protocol.


A prerequisite for Coc is Node.js as it's written in TypeScript. Navigate to vimawesome and copy install from script for the plugin manager you already installed earlier. Open your .vimrc and paste the copied plugin reference and run :source % and :PluginInstall to install the plugin.

From this point onwards we can use Coc intellisense, but there are a couple of commands that can be mapped from .vimrc to make it really convenient to be used quickly. Coc README offers a starting point for this configuration. This configuration can be copied and pasted to .vimrc. This will add few key mappings like gr, gi, gd for moving to method references, implementations, and definitions.

For every programming language Coc expects extensions to be installed. For an example for web development following command can be used.

:CocInstall coc-tsserver coc-html coc-css

This adds intellisense support TypeScript, HTML, and CSS.

Once that's done, that's all what we need for intellisense 🎉

Documentation with K mapping

📄 Check out my not so minimal and messy .vimrc

Discussion (3)

Editor guide
brandonskerritt profile image

Hey! Just noticed this article didn't have a lot of love. Thanks for this! This came up on Google for me, and I used it. I didn't realise you had to use the .vimrc script, thanks!!

rajikaimal profile image
Rajika Imal Author

Hey Brandon, glad you found the article useful, hopefully everything worked fine 😄 Here's my .vimrc if you you want to take a look just in case. (It's kind of messy though)

smalinux profile image
Sohaib Mohammed

Hi! What theme name you use? Thanks )