Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save daGrevis/d66e9e021f2b733ca99060bfacab9494 to your computer and use it in GitHub Desktop.
Save daGrevis/d66e9e021f2b733ca99060bfacab9494 to your computer and use it in GitHub Desktop.
" VimL source.
Plug 'Shougo/neco-vim'
Plug 'https://github.com/neoclide/coc-neco'
" CSS source.
Plug 'neoclide/coc-css', {'do': 'yarn install --frozen-lockfile --force'}
" JSON source.
Plug 'neoclide/coc-json', {'do': 'yarn install --frozen-lockfile --force'}
" JavaScript and TypeScript source.
Plug 'neoclide/coc-tsserver', {'do': 'yarn install --frozen-lockfile --force'}
" ESLint source.
Plug 'neoclide/coc-eslint', {'do': 'yarn install --frozen-lockfile --force'}
" Prettier source.
Plug 'neoclide/coc-prettier', {'do': 'yarn install --frozen-lockfile --force'}
" IntelliSense engine.
Plug 'neoclide/coc.nvim', {'do': { -> coc#util#install() }}
" :CocInstall coc-eslint coc-prettier coc-html coc-yaml
" Confirm completion.
inoremap <expr> <CR> pumvisible() ? "\<C-y>" : "\<C-g>u\<CR>"
" Navigate diagnostics.
nmap <silent> [l <Plug>(coc-diagnostic-prev)
nmap <silent> ]l <Plug>(coc-diagnostic-next)
nmap <silent> gd <Plug>(coc-definition)
nmap <silent> gy <Plug>(coc-type-definition)
nmap <silent> gi <Plug>(coc-implementation)
nmap <silent> gr <Plug>(coc-references)
function! s:show_documentation()
if &filetype == 'vim'
execute 'h '.expand('<cword>')
else
call CocAction('doHover')
endif
endfunction
nnoremap <silent> gk :call <SID>show_documentation()<CR>
command! -nargs=0 Prettier :CocCommand prettier.formatFile
call coc#config('coc.preferences', {
\ 'diagnostic.errorSign': 'E',
\ 'diagnostic.warningSign': 'W',
\ 'diagnostic.infoSign': 'I',
\ 'diagnostic.hintSign': 'H',
\ })
call coc#config('tsserver', {
\ 'enableJavascript': 0,
\ })
call coc#config('eslint', {
\ 'enable': 1,
\ 'packageManager': 'yarn',
\ 'filetypes': ['javascript', 'javascriptreact', 'javascript.jsx', 'javascript.flow.jsx', 'typescript'],
\ })
call coc#config('languageserver.flow', {
\ 'command': './node_modules/.bin/flow',
\ 'args': ['lsp'],
\ 'filetypes': ['javascript.flow.jsx'],
\ 'initializationOptions': {},
\ 'requireRootPattern': 1,
\ 'settings': {},
\ 'rootPatterns': ['.flowconfig']
\ })
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment