diff --git a/autoload/neosnippet.vim b/autoload/neosnippet.vim index 3cf90c4..a9c6b54 100644 --- a/autoload/neosnippet.vim +++ b/autoload/neosnippet.vim @@ -1,7 +1,7 @@ "============================================================================= " FILE: neosnippet.vim " AUTHOR: Shougo Matsushita -" Last Modified: 20 Jan 2013. +" Last Modified: 16 Feb 2013. " License: MIT license {{{ " Permission is hereby granted, free of charge, to any person obtaining " a copy of this software and associated documentation files (the @@ -1238,6 +1238,40 @@ function! s:skip_next_auto_completion() "{{{ endif endfunction"}}} +function! s:on_insert_leave() "{{{ + " Get patterns and count. + if empty(s:snippets_expand_stack) + return + endif + + let expand_info = s:snippets_expand_stack[-1] + + " Search patterns. + let [begin, end] = s:get_snippet_range( + \ expand_info.begin_line, + \ expand_info.begin_patterns, + \ expand_info.end_line, + \ expand_info.end_patterns) + if begin != end + return + endif + + let pos = getpos('.') + try + while s:search_snippet_range(begin, end, expand_info.holder_cnt) + " Next count. + let expand_info.holder_cnt += 1 + endwhile + + " Search placeholder 0. + call s:search_snippet_range(begin, end, 0) + + finally + stopinsert + call setpos('.', pos) + endtry +endfunction"}}} + if g:neosnippet#enable_snipmate_compatibility " For snipMate function. function! Filename(...) @@ -1312,6 +1346,7 @@ function! s:initialize_others() "{{{ \ call neosnippet#recaching() autocmd BufEnter * \ call neosnippet#clear_select_mode_mappings() + autocmd InsertLeave * call s:on_insert_leave() augroup END"}}} augroup neosnippet diff --git a/doc/neosnippet.txt b/doc/neosnippet.txt index e69e027..04ed32d 100755 --- a/doc/neosnippet.txt +++ b/doc/neosnippet.txt @@ -656,6 +656,8 @@ line in snippet end, you must insert placeholder. < +Note: If you expand oneline snippet, the markers will be deleted in +|InsertLeave|. ============================================================================== UNITE SOURCES *neosnippet-unite-sources* @@ -721,6 +723,7 @@ CHANGELOG *neosnippet-changelog* 2013-02-16 - Added sh snippet. - Added html snippet. +- Delete simple markers when InsertLeave. 2013-02-03 - Improved php snippets.