better usability for snippets in coc

master
TiynGER 5 years ago
parent ec70c48df2
commit c5e154bbaa

@ -63,7 +63,7 @@ autocmd BufWritePre * %s/\s\+$//e
" Plugin section " Plugin section
call plug#begin('~/.config/nvim/plugged') call plug#begin('~/.config/nvim/plugged')
Plug 'neoclide/coc.nvim', {'branch': 'release'} " Autocomplete Plug 'neoclide/coc.nvim', {'branch': 'release'} " Autocomplete
Plug 'lervag/vimtex', {'for': 'tex'} " library for coc autocomplete Plug 'lervag/vimtex' , { 'for' : 'tex'} " tex library for coc autocompletion
Plug 'donRaphaco/neotex', { 'for': 'tex'} " Asynchronous pdf rendering Plug 'donRaphaco/neotex', { 'for': 'tex'} " Asynchronous pdf rendering
Plug 'preservim/nerdtree' " Filetree Plug 'preservim/nerdtree' " Filetree
Plug 'majutsushi/tagbar' " Show tags Plug 'majutsushi/tagbar' " Show tags
@ -74,18 +74,21 @@ call plug#end()
" Coc extensions " Coc extensions
let g:coc_global_extensions = ['coc-snippets', 'coc-vimtex'] let g:coc_global_extensions = ['coc-snippets', 'coc-vimtex']
" tab through suggestions
" Coc remaps let g:coc_snippet_next = '<tab>'
inoremap <silent><expr> <TAB> inoremap <silent><expr> <TAB>
\ pumvisible() ? "\<C-n>" : \ pumvisible() ? "\<C-n>" :
\ <SID>check_back_space() ? "\<TAB>" : \ <SID>check_back_space() ? "\<TAB>" :
\ coc#refresh() \ coc#refresh()
" jump to next placeholder
inoremap <expr><S-TAB> pumvisible() ? "\<C-p>" : "\<C-h>" inoremap <expr><S-TAB> pumvisible() ? "\<C-p>" : "\<C-h>"
" ending suggestions
function! s:check_back_space() abort function! s:check_back_space() abort
let col = col('.') - 1 let col = col('.') - 1
return !col || getline('.')[col - 1] =~# '\s' return !col || getline('.')[col - 1] =~# '\s'
endfunction endfunction
" expand snippets on enter
inoremap <expr> <cr> pumvisible() ? "\<C-y>" : "\<CR>"
"tagbar "tagbar
map <F3> :TagbarToggle<CR> map <F3> :TagbarToggle<CR>

Loading…
Cancel
Save