diff --git a/plugin/UltiSnips/__init__.py b/plugin/UltiSnips/__init__.py index 0613bcf..e943d9f 100644 --- a/plugin/UltiSnips/__init__.py +++ b/plugin/UltiSnips/__init__.py @@ -263,7 +263,8 @@ class SnippetManager(object): start = Position(end.line, end.col - len(snippet.trigger)) # TODO: very much the same as above - indent = vim.current.line[:pos.col - len(snippet.trigger)] + text_before = vim.current.line[:pos.col - len(snippet.trigger)] + indent = snippet._INDENT.match(text_before).group(0) v = snippet.value if indent.strip(" \n") == "": lines = v.splitlines() diff --git a/test.py b/test.py index 52ba217..f2c8ec7 100755 --- a/test.py +++ b/test.py @@ -532,6 +532,10 @@ class RecTabStops_InNewlineManualIndent_ECR(_VimTest): snippets = ("m", "M START\n$0\nM END") keys = "m" + EX + " m" + EX + "hi" wanted = "M START\n M START\n hi\n M END\nM END" +class RecTabStops_InNewlineManualIndentTextInFront_ECR(_VimTest): + snippets = ("m", "M START\n$0\nM END") + keys = "m" + EX + " hallo m" + EX + "hi" + wanted = "M START\n hallo M START\n hi\n M END\nM END" class RecTabStops_InNewlineMultilineWithIndent_ECR(_VimTest): snippets = ("m", "M START\n $0\nM END") keys = "m" + EX + "m" + EX + "hi"