diff --git a/autoload/neosnippet.vim b/autoload/neosnippet.vim index 106b8e3..c38d8ed 100644 --- a/autoload/neosnippet.vim +++ b/autoload/neosnippet.vim @@ -47,7 +47,10 @@ call neosnippet#util#set_default( call neosnippet#util#set_default( \ 'g:neosnippet#enable_auto_clear_markers', 1) call neosnippet#util#set_default( - \ 'g:neosnippet#completed_pairs',{'_':{ '(' : ')', '{' : '}', '"' : '"' }}) + \ 'g:neosnippet#completed_pairs', {}) +call neosnippet#util#set_default( + \ 'g:neosnippet#_completed_pairs', + \ {'_':{ '(' : ')', '{' : '}', '"' : '"' }}) "}}} function! neosnippet#expandable_or_jumpable() "{{{ diff --git a/autoload/neosnippet/parser.vim b/autoload/neosnippet/parser.vim index 9d7e08e..4b79a52 100644 --- a/autoload/neosnippet/parser.vim +++ b/autoload/neosnippet/parser.vim @@ -304,11 +304,9 @@ function! neosnippet#parser#_get_completed_snippet(completed_item, next_text) "{ if item.info != '' let abbr = split(item.info, '\n')[0] endif - if index(keys(g:neosnippet#completed_pairs),expand(&ft)) < 0 - let pairs = g:neosnippet#completed_pairs._ - else - let pairs = g:neosnippet#completed_pairs[expand(&ft)] - endif + let pairs = neosnippet#util#get_buffer_config( + \ &filetype, '', + \ 'g:neosnippet#completed_pairs', 'g:neosnippet#_completed_pairs', {}) let word_pattern = neosnippet#util#escape_pattern(item.word) let angle_pattern = word_pattern . '<.\+>(.*)' let no_key = index(keys(pairs), item.word[-1:]) < 0 @@ -366,7 +364,8 @@ function! neosnippet#parser#_get_completed_snippet(completed_item, next_text) "{ let args = '' for arg in split(substitute( \ neosnippet#parser#_get_in_paren(key, pair, abbr), - \ key.'\zs.\{-}\ze'.pair, '', 'g'), '[^[]\zs\s*,\s*') + \ key.'\zs.\{-}\ze'.pair . '\|<\zs.\{-}\ze>', '', 'g'), + \ '[^[]\zs\s*,\s*') if key ==# '(' && arg ==# 'self' && &filetype ==# 'python' " Ignore self argument continue diff --git a/test/functions.vim b/test/functions.vim index 1653383..32aedb7 100644 --- a/test/functions.vim +++ b/test/functions.vim @@ -123,5 +123,10 @@ function! s:suite.get_completed_snippet() \ 'word' : 'Dictionary', 'abbr' : 'Dictionary(foo)', \ 'menu' : '', 'info' : '' \ }, ''), '(${1:#:foo})${2}') + + call s:assert.equals(neosnippet#parser#_get_completed_snippet({ + \ 'word' : 'forEach', 'abbr' : 'forEach(BiConsumer)', + \ 'menu' : '', 'info' : '' + \ }, ''), '(${1:#:BiConsumer<>})${2}') endfunction