diff options
Diffstat (limited to 'plugin/snip.vim')
-rw-r--r-- | plugin/snip.vim | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/plugin/snip.vim b/plugin/snip.vim new file mode 100644 index 0000000..5f8bfc3 --- /dev/null +++ b/plugin/snip.vim @@ -0,0 +1,30 @@ +" 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 <leader>x for convert visual selected code to snippet +xmap <leader>x <Plug>(coc-convert-snippet) + +inoremap <silent><expr> <TAB> + \ pumvisible() ? coc#_select_confirm() : + \ coc#expandableOrJumpable() ? "\<C-r>=coc#rpc#request('doKeymap', ['snippets-expand-jump',''])\<CR>" : + \ <SID>check_back_space() ? "\<TAB>" : + \ coc#refresh() + +function! s:check_back_space() abort + let col = col('.') - 1 + return !col || getline('.')[col - 1] =~# '\s' +endfunction + +let g:coc_snippet_next = '<tab>' |