diff --git a/autoload/delimitMate.vim b/autoload/delimitMate.vim index 00ae6ed..8e0465a 100644 --- a/autoload/delimitMate.vim +++ b/autoload/delimitMate.vim @@ -418,7 +418,9 @@ function! delimitMate#ExpandReturn() "{{{ " Not sure why I used the previous combos, but I'm sure somebody will tell " me about it. - return "\a\\O" + " XXX zv prevents breaking expansion with syntax folding enabled by + " InsertLeave. + return "\a\\zvO" else return "\" endif diff --git a/test/expand_cr.txt b/test/expand_cr.txt index 331add6..190768b 100644 --- a/test/expand_cr.txt +++ b/test/expand_cr.txt @@ -46,5 +46,20 @@ sub foo { call setline(1, "\"{bracketed}") normal A"x ================================================================================ -"{bracketed}"x +"{bracketed""x +-------------------------------------------------------------------------------- +# Syntax folding enabled by autocmd breaks expansion. But ti can't be tested +# with :normal +new +autocmd InsertEnter * let w:fdm=&foldmethod | setl foldmethod=manual +autocmd InsertLeave * let &foldmethod = w:fdm +set foldmethod=marker +set foldmarker={,} +set foldlevel=0 +set backspace=2 +exec "normal iabc {\x" +================================================================================ +abc { + x +} --------------------------------------------------------------------------------