diff --git a/plugin/UltiSnips/_vim.py b/plugin/UltiSnips/_vim.py index 18be1df..565a562 100755 --- a/plugin/UltiSnips/_vim.py +++ b/plugin/UltiSnips/_vim.py @@ -64,10 +64,6 @@ buf = VimBuffer() def text_to_vim(start, end, text): lines = text.split('\n') - # Open any folds this might have created - buf.cursor = start - vim.command("normal zv") - new_end = _calc_end(lines, start) before = buf[start.line][:start.col] @@ -80,6 +76,10 @@ def text_to_vim(start, end, text): new_lines[-1] += after buf[start.line:end.line + 1] = new_lines + # Open any folds this might have created + buf.cursor = start + vim.command("normal zv") + return new_end def escape(inp):