for snippets that contain linebreak

This commit is contained in:
h-youhei 2017-03-13 03:06:16 +09:00
parent ea693eebb0
commit 24db4b3c7f

View File

@ -40,7 +40,7 @@ endif
setlocal autoindent setlocal autoindent
setlocal indentexpr=SnippetsIndent() setlocal indentexpr=SnippetsIndent()
setlocal indentkeys=o,O,=abbr\ ,=prev_word\ ,=alias\ ,=options\ ,=regexp\ ,!^F setlocal indentkeys=o,O,=include\ ,=snippet\ ,=abbr\ ,=prev_word\ ,=delete\ ,=alias\ ,=options\ ,=regexp\ ,!^F
let b:undo_indent .= 'setlocal let b:undo_indent .= 'setlocal
\ autoindent< \ autoindent<
@ -56,9 +56,7 @@ function! SnippetsIndent() abort "{{{
"for indentkeys o,O "for indentkeys o,O
if s:is_empty(line) if s:is_empty(line)
if s:is_empty(prev_line) if prev_line =~ '^' . defining
return 0
elseif prev_line =~ '^' . defining
return shiftwidth() return shiftwidth()
else else
return -1 return -1
@ -67,6 +65,8 @@ function! SnippetsIndent() abort "{{{
"for indentkeys =words "for indentkeys =words
else else
if line =~ '^\s*' . syntax if line =~ '^\s*' . syntax
\ && (s:is_empty(prev_line)
\ || prev_line =~ '^' . defining)
return 0 return 0
else else
return -1 return -1