| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758 |
- " Thanks https://www.chrisatmachine.com/Neovim/17-snippets/
- " Use <C-l> for trigger snippet expand.
- imap <C-l> <Plug>(coc-snippets-expand)
- " Use <C-j> for select text for visual placeholder of snippet.
- vmap <C-j> <Plug>(coc-snippets-select)
- " Use <C-j> for jump to next placeholder, it's default of coc.nvim
- let g:coc_snippet_next = '<c-j>'
- " Use <C-k> for jump to previous placeholder, it's default of coc.nvim
- let g:coc_snippet_prev = '<c-k>'
- " Use <C-j> for both expand and jump (make expand higher priority.)
- imap <C-j> <Plug>(coc-snippets-expand-jump)
- " Use `[g` and `]g` to navigate diagnostics
- " Use `:CocDiagnostics` to get all diagnostics of current buffer in location list.
- nmap <silent> [g <Plug>(coc-diagnostic-prev)
- nmap <silent> ]g <Plug>(coc-diagnostic-next)
- " GoTo code navigation.
- 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)
- inoremap <silent><expr> <Tab>
- " Use K to show documentation in preview window.
- nnoremap <silent> K :call <SID>show_documentation()<CR>
- function! s:show_documentation()
- if CocAction('hasProvider', 'hover')
- call CocActionAsync('doHover')
- else
- call feedkeys('K', 'in')
- endif
- endfunction
- " MDX
- " Thanks https://github.com/neoclide/coc-prettier/issues/127#issuecomment-850598753
- let g:coc_filetype_map = { 'markdown.mdx': 'mdx' }
- " use <tab> for trigger completion and navigate to the next complete item
- function! s:check_back_space() abort
- let col = col('.') - 1
- return !col || getline('.')[col - 1] =~ '\s'
- endfunction
- " Use tab for trigger completion with characters ahead and navigate.
- " NOTE: Use command ':verbose imap <tab>' to make sure tab is not mapped by
- " other plugin before putting this into your config.
- inoremap <silent><expr> <TAB>
- \ pumvisible() ? "\<C-n>" :
- \ <SID>check_back_space() ? "\<TAB>" :
- \ coc#refresh()
- inoremap <expr><S-TAB> pumvisible() ? "\<C-p>" : "\<C-h>"
|