Skip to main content
Quick setup

Setup coc.nvim

Get completion, diagnostics, and code navigation working in three focused steps.

1

Check your environment

You need Node.js and either a supported Neovim or Vim.

Node.js22.15.0
node --version
Neovim0.8.0
nvim --version
Vim9.0.0438
vim --version
2

Install with one command

Choose your editor, review the command, then run it in a terminal.

Quick Script InstallRecommended

Uses the selected editor's native pack mechanism. Run again anytime to update.

Review what it runs before executing: view installer source.

curl -fsSL https://cocnvim.com/install-coc.sh | bash -s -- --editor=nvim
Zero plugin manager required
One command to install & update
Pre-compiled release branch

The script checks Node.js and Neovim, detects another coc.nvim installation, then shows every planned path before confirmation. It installs to ${XDG_DATA_HOME:-~/.local/share}/nvim/site/pack/coc/opt/coc.nvim and the Neovim init file and preserves an existing native-pack copy as .backup-*. It adds one idempotent packadd coc.nvim entry when the config does not already load coc.nvim. Use --no-config / -NoConfig to leave config unchanged.

Prefer a plugin manager, native package, or source build? See all installation methods.

3

Enable the essentials

Select language support on the left and copy the generated editor setup.

Language support

0 selected

Optional. Selected extensions are installed automatically when coc.nvim starts.

~/.config/nvim/init.lua
1-- Add to ~/.config/nvim/init.lua
2vim.g.coc_global_extensions = { }
3 
4vim.opt.backup = false
5vim.opt.writebackup = false
6vim.opt.updatetime = 300
7vim.opt.signcolumn = 'yes'
8vim.opt.laststatus = 2
9 
10-- Show coc.nvim status, including extension installation progress
11vim.opt.statusline:prepend('%{coc#status()}')
12 
13local keyset = vim.keymap.set
14function _G.check_back_space()
15 local col = vim.fn.col('.') - 1
16 return col == 0 or vim.fn.getline('.'):sub(col, col):match('%s') ~= nil
17end
18 
19-- Trigger completion with Tab and navigate the completion menu
20local opts = { silent = true, noremap = true, expr = true, replace_keycodes = false }
21keyset('i', '<TAB>', 'coc#pum#visible() ? coc#pum#next(1) : v:lua.check_back_space() ? "<TAB>" : coc#refresh()', opts)
22keyset('i', '<S-TAB>', [[coc#pum#visible() ? coc#pum#prev(1) : "\<C-h>"]], opts)
23keyset('i', '<CR>', 'coc#pum#visible() ? coc#pum#confirm() : "\<C-g>u\<CR>\<c-r>=coc#on_enter()\<CR>"', { silent = true, expr = true })
24 
25-- Diagnostics and code navigation
26keyset('n', '[g', '<Plug>(coc-diagnostic-prev)', { silent = true })
27keyset('n', ']g', '<Plug>(coc-diagnostic-next)', { silent = true })
28keyset('n', 'gd', '<Plug>(coc-definition)', { silent = true })
29keyset('n', 'gy', '<Plug>(coc-type-definition)', { silent = true })
30keyset('n', 'gi', '<Plug>(coc-implementation)', { silent = true })
31keyset('n', 'gr', '<Plug>(coc-references)', { silent = true })
32keyset('n', '<leader>rn', '<Plug>(coc-rename)', { silent = true })

The extension list is optional. coc.nvim provides the client; language features become available after an extension or manually configured server starts.

Restart your editor and try it

Open a file for a selected language, then run :CocInfo to confirm coc.nvim and its language service are running.

Troubleshoot setup
Go further

Advanced setup and resources

Read the configuration file guide