- Improved indent snippet behavior.

This commit is contained in:
Shougo Matsushita 2012-10-06 16:22:36 +09:00
commit 88821a7d9b
3 changed files with 33 additions and 25 deletions

View File

@ -1,7 +1,7 @@
"============================================================================= "=============================================================================
" FILE: snippets_complete.vim " FILE: snippets_complete.vim
" AUTHOR: Shougo Matsushita <Shougo.Matsu@gmail.com> " AUTHOR: Shougo Matsushita <Shougo.Matsu@gmail.com>
" Last Modified: 04 Oct 2012. " Last Modified: 06 Oct 2012.
" License: MIT license {{{ " License: MIT license {{{
" Permission is hereby granted, free of charge, to any person obtaining " Permission is hereby granted, free of charge, to any person obtaining
" a copy of this software and associated documentation files (the " a copy of this software and associated documentation files (the

View File

@ -1,7 +1,7 @@
"============================================================================= "=============================================================================
" FILE: neosnippet.vim " FILE: neosnippet.vim
" AUTHOR: Shougo Matsushita <Shougo.Matsu@gmail.com> " AUTHOR: Shougo Matsushita <Shougo.Matsu@gmail.com>
" Last Modified: 04 Oct 2012. " Last Modified: 06 Oct 2012.
" License: MIT license {{{ " License: MIT license {{{
" Permission is hereby granted, free of charge, to any person obtaining " Permission is hereby granted, free of charge, to any person obtaining
" a copy of this software and associated documentation files (the " a copy of this software and associated documentation files (the
@ -568,9 +568,14 @@ function! neosnippet#expand(cur_text, col, trigger_name)"{{{
endfunction"}}} endfunction"}}}
function! s:indent_snippet(begin, end)"{{{ function! s:indent_snippet(begin, end)"{{{
let equalprg = &l:equalprg let equalprg = &l:equalprg
let pos = getpos('.')
try
setlocal equalprg= setlocal equalprg=
let pos = getpos('.') " Indent begin line.
call cursor(a:begin, 0)
silent normal! ==
let base_indent = matchstr(getline(a:begin), '^\s\+') let base_indent = matchstr(getline(a:begin), '^\s\+')
for line_nr in range(a:begin+1, a:end) for line_nr in range(a:begin+1, a:end)
@ -592,10 +597,10 @@ function! s:indent_snippet(begin, end)"{{{
silent normal! == silent normal! ==
endif endif
endfor endfor
finally
call setpos('.', pos)
let &l:equalprg = equalprg let &l:equalprg = equalprg
call setpos('.', pos)
endtry
endfunction"}}} endfunction"}}}
function! s:get_snippet_range(begin_line, begin_patterns, end_line, end_patterns)"{{{ function! s:get_snippet_range(begin_line, begin_patterns, end_line, end_patterns)"{{{

View File

@ -407,6 +407,9 @@ snippet *neosnippet-unite-action-snippet*
============================================================================== ==============================================================================
CHANGELOG *neosnippet-changelog* CHANGELOG *neosnippet-changelog*
2012-10-06
- Improved indent snippet behavior.
2012-10-04 2012-10-04
- Refactored snippets filter. - Refactored snippets filter.
- Changed :NeoSnippetEdit behavior. - Changed :NeoSnippetEdit behavior.