From db72ae67713e4679bca48b387744e51e73126f7f Mon Sep 17 00:00:00 2001 From: Shougo Matsushita Date: Fri, 12 Jul 2013 14:10:45 +0900 Subject: [PATCH] - Improved stopinsert. --- autoload/neosnippet.vim | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/autoload/neosnippet.vim b/autoload/neosnippet.vim index dc92376..81219c1 100644 --- a/autoload/neosnippet.vim +++ b/autoload/neosnippet.vim @@ -1,7 +1,7 @@ "============================================================================= " FILE: neosnippet.vim " AUTHOR: Shougo Matsushita -" Last Modified: 11 Jul 2013. +" Last Modified: 12 Jul 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 @@ -1283,17 +1283,25 @@ function! s:on_insert_leave() "{{{ \ expand_info.end_patterns) let pos = getpos('.') + + " Found snippet. + let found = 0 try while s:search_snippet_range(begin, end, expand_info.holder_cnt, 0) " Next count. let expand_info.holder_cnt += 1 + let found = 1 endwhile " Search placeholder 0. - call s:search_snippet_range(begin, end, 0) - + if s:search_snippet_range(begin, end, 0) + let found = 1 + endif finally - stopinsert + if found + stopinsert + endif + call setpos('.', pos) endtry endfunction"}}}