From ecb7dfdf64d44743fa6279dc83c87384dea6b4c6 Mon Sep 17 00:00:00 2001 From: mMontu Date: Sun, 10 Nov 2013 21:15:24 -0200 Subject: [PATCH] Change default value/check, fix for nested snippets --- doc/UltiSnips.txt | 9 --------- plugin/UltiSnips.vim | 2 +- plugin/UltiSnips/__init__.py | 7 ++++--- 3 files changed, 5 insertions(+), 13 deletions(-) diff --git a/doc/UltiSnips.txt b/doc/UltiSnips.txt index c3a6f6b..ac4a7f9 100644 --- a/doc/UltiSnips.txt +++ b/doc/UltiSnips.txt @@ -240,15 +240,6 @@ vimrc file. > let g:UltiSnipsJumpForwardTrigger="" let g:UltiSnipsJumpBackwardTrigger="" -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 - mappings only during snippet expansions. - 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 following to your vimrc file. > diff --git a/plugin/UltiSnips.vim b/plugin/UltiSnips.vim index 191665e..cc4451d 100644 --- a/plugin/UltiSnips.vim +++ b/plugin/UltiSnips.vim @@ -88,7 +88,7 @@ endif " Should UltiSnips map JumpForwardTrigger and JumpBackwardTrigger only during " snippet expansion? if !exists("g:UltiSnipsClearJumpTrigger") - let g:UltiSnipsClearJumpTrigger = 0 + let g:UltiSnipsClearJumpTrigger = 1 endif " }}} diff --git a/plugin/UltiSnips/__init__.py b/plugin/UltiSnips/__init__.py index e14b06f..88d84a1 100644 --- a/plugin/UltiSnips/__init__.py +++ b/plugin/UltiSnips/__init__.py @@ -763,8 +763,9 @@ class SnippetManager(object): def _current_snippet_is_done(self): self._csnippets.pop() - if _vim.eval("g:UltiSnipsClearJumpTrigger") == "1": - _vim.command("call UltiSnips_RestoreInnerKeys()") + if _vim.eval("g:UltiSnipsClearJumpTrigger") != "0": + if len(self._csnippets) == 0: + _vim.command("call UltiSnips_RestoreInnerKeys()") def _jump(self, backwards = False): jumped = False @@ -881,7 +882,7 @@ class SnippetManager(object): that needs to be done with it. """ 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 text_before = before if snippet.matched: