Change default value/check, fix for nested snippets

This commit is contained in:
mMontu 2013-11-10 21:15:24 -02:00
parent 6d7f52bb6e
commit ecb7dfdf64
3 changed files with 5 additions and 13 deletions

View File

@ -240,15 +240,6 @@ vimrc file. >
let g:UltiSnipsJumpForwardTrigger="<tab>" let g:UltiSnipsJumpForwardTrigger="<tab>"
let g:UltiSnipsJumpBackwardTrigger="<s-tab>" let g:UltiSnipsJumpBackwardTrigger="<s-tab>"
The mapping of g:UltiSnipsJumpForwardTrigger and g:UltiSnipsJumpBackwardTrigger
can be controlled with this option:
*g:UltiSnipsClearJumpTrigger*
g:UltiSnipsClearJumpTrigger By default both triggers are global mappings
that are always present. By setting this
variable to 1 the plugin will define <buffer>
mappings only during snippet expansions.
Note that the default value for g:UltiSnipsJumpBackwardTrigger interferes with Note that the default value for g:UltiSnipsJumpBackwardTrigger interferes with
the built-in complete function: |i_CTRL-X_CTRL-K|. A workaround is to add the the built-in complete function: |i_CTRL-X_CTRL-K|. A workaround is to add the
following to your vimrc file. > following to your vimrc file. >

View File

@ -88,7 +88,7 @@ endif
" Should UltiSnips map JumpForwardTrigger and JumpBackwardTrigger only during " Should UltiSnips map JumpForwardTrigger and JumpBackwardTrigger only during
" snippet expansion? " snippet expansion?
if !exists("g:UltiSnipsClearJumpTrigger") if !exists("g:UltiSnipsClearJumpTrigger")
let g:UltiSnipsClearJumpTrigger = 0 let g:UltiSnipsClearJumpTrigger = 1
endif endif
" }}} " }}}

View File

@ -763,8 +763,9 @@ class SnippetManager(object):
def _current_snippet_is_done(self): def _current_snippet_is_done(self):
self._csnippets.pop() self._csnippets.pop()
if _vim.eval("g:UltiSnipsClearJumpTrigger") == "1": if _vim.eval("g:UltiSnipsClearJumpTrigger") != "0":
_vim.command("call UltiSnips_RestoreInnerKeys()") if len(self._csnippets) == 0:
_vim.command("call UltiSnips_RestoreInnerKeys()")
def _jump(self, backwards = False): def _jump(self, backwards = False):
jumped = False jumped = False
@ -881,7 +882,7 @@ class SnippetManager(object):
that needs to be done with it. that needs to be done with it.
""" """
if _vim.eval("g:UltiSnipsClearJumpTrigger") == "1": if _vim.eval("g:UltiSnipsClearJumpTrigger") == "1":
_vim.command("call UltiSnips_MapInnerKeys()") _vim.command("call UltiSnips_MapInnerKeys()")
# Adjust before, maybe the trigger is not the complete word # Adjust before, maybe the trigger is not the complete word
text_before = before text_before = before
if snippet.matched: if snippet.matched: