# Coc [Conquer of completion](https://github.com/neoclide/coc.nvim) enables full language server protocol support for neovim. It is written specifically for neovim. The coc config file is located in `.config/nvim/coc-settings.json`. ## Installation - Install `nodejs` - Install [vim-plug](vim-plug.md) - Add coc.vim to your init.vim - Add `Plug 'neoclide/coc.nvim', {'do': 'yarn install --frozen-lockfile'}` to your Plug-Section ## Base config Add the base configuration to your vim config file. ```vimscript " neoclide/coc.nvim inoremap \ pumvisible() ? "\" : \ check_back_space() ? "\" : \ coc#refresh() inoremap pumvisible() ? "\" : "\" function! s:check_back_space() abort let col = col('.') - 1 return !col || getline('.')[col - 1] =~# '\s' endfunction if has('nvim') inoremap coc#refresh() else inoremap coc#refresh() endif inoremap pumvisible() ? coc#_select_confirm() \: "\u\\=coc#on_enter()\" nmap gd (coc-definition) nmap gy (coc-type-definition) nmap gi (coc-implementation) nmap gr (coc-references) nnoremap K :call show_documentation() function! s:show_documentation() if (index(['vim','help'], &filetype) >= 0) execute 'h '.expand('') elseif (coc#rpc#ready()) call CocActionAsync('doHover') else execute '!' . &keywordprg . " " . expand('') endif endfunction autocmd CursorHold * silent call CocActionAsync('highlight') nmap (coc-rename) xmap f (coc-format-selected) nmap f (coc-format-selected) augroup mygroup autocmd! autocmd FileType typescript,json setl formatexpr=CocAction('formatSelected') autocmd User CocJumpPlaceholder call CocActionAsync('showSignatureHelp') augroup end ``` ## Extensions Extensions can be added to the vim config aswell. A basic example for adding a few extensions is: ```vimscript let g:coc_global_extensions = [ \ 'coc-java', \ 'coc-markdownlint', \ 'coc-python', \ 'coc-sh', \ 'coc-vimtex', \ ] ```