" Use system (homebrew) node let g:coc_node_path = '/usr/local/bin/node' " Use to trigger completion inoremap coc#refresh() " Use [[ and ]] to navigate diagnostics nmap [[ (coc-diagnostic-prev) nmap ]] (coc-diagnostic-next) nmap gd (coc-definition) nmap gD (coc-declaration) nmap gi (coc-implementation) nmap gy (coc-type-definition) nmap gr (coc-references) nmap gR (coc-refactor) nmap gQ (coc-format-selected) vmap gQ (coc-format-selected) nmap (coc-rename) xmap if (coc-funcobj-i) xmap af (coc-funcobj-a) omap if (coc-funcobj-i) omap af (coc-funcobj-a) " Use K to show documentation in preview window nnoremap K :call show_documentation() function! s:show_documentation() abort if &filetype =~# '^\%(vim\|help\)$' try execute 'help' expand('') catch echohl Error echo v:exception echohl None endtry else call CocAction('doHover') endif endfunction augroup my-coc autocmd! * " Highlight symbol under cursor on CursorHold autocmd CursorHold * silent call CocActionAsync('highlight') " Setup formatexpr specified filetype autocmd FileType typescript,json,rust setlocal formatexpr=CocAction('formatSelected') " Update signature help on jump placeholder autocmd User CocJumpPlaceholder call CocActionAsync('showSignatureHelp') augroup END " Use `:Format` to format current buffer command! -nargs=0 CocFormat call CocAction('format') " Use `:Fold` to fold current buffer command! -nargs=? CocFold call CocAction('fold', ) " use `:OR` for organize import of current buffer command! -nargs=0 CocOr call CocAction('runCommand', 'editor.action.organizeImport') function! s:install_extensions() abort " Fundemental CocInstall coc-tabnine CocInstall coc-yank CocInstall coc-word CocInstall coc-snippets CocInstall coc-emmet " Filetype CocInstall coc-prettier CocInstall coc-eslint CocInstall coc-css CocInstall coc-html CocInstall coc-tsserver CocInstall coc-vetur CocInstall coc-yaml CocInstall coc-python CocInstall coc-pyright CocInstall coc-json CocInstall coc-xml CocInstall coc-go CocInstall coc-rls CocInstall coc-rust-analyzer CocInstall coc-vimlsp CocInstall coc-highlight " Experimental CocInstall coc-omnisharp CocInstall coc-jest CocInstall coc-sql CocInstall coc-sh CocInstall coc-lua CocInstall coc-gitignore CocInstall coc-webpack endfunction command! -nargs=0 CocInstallExtensions call s:install_extensions()