Add auto pairs support

This commit is contained in:
Shougo Matsushita 2015-11-21 13:27:09 +09:00
parent 60813b5b27
commit 02176938f7

View File

@ -72,6 +72,10 @@ function! neosnippet#handlers#_complete_done() "{{{
if snippet !~ ')$'
let snippet .= ')'
endif
if s:is_auto_pairs()
" Remove auto pair from the snippet
let snippet = substitute(snippet, ')$', '', '')
endif
let snippet .= '${0}'
let options = neosnippet#parser#_initialize_snippet_options()
@ -126,6 +130,11 @@ function! neosnippet#handlers#_get_in_paren(str) abort "{{{
return s
endfunction"}}}
function! s:is_auto_pairs() abort "{{{
return get(g:, 'deoplete#enable_auto_pairs', 0)
\ || get(g:, 'neocomplete#enable_auto_pairs', 0)
endfunction"}}}
let &cpo = s:save_cpo
unlet s:save_cpo