diff --git a/plugin/UltiSnips/Util.py b/plugin/UltiSnips/Util.py index e7bf2de..14fd46f 100644 --- a/plugin/UltiSnips/Util.py +++ b/plugin/UltiSnips/Util.py @@ -17,6 +17,8 @@ class IndentUtil(object): self.et = (vim.eval("&expandtab") == "1") self.ts = int(vim.eval("&ts")) + self.tab = self.sts or self.ts + def indent_to_spaces(self, indent): """ Converts indentation to spaces respecting vim settings. """ indent = indent.replace(" " * self.ts, "\t") diff --git a/plugin/UltiSnips/__init__.py b/plugin/UltiSnips/__init__.py index 2669c0c..37a75d8 100644 --- a/plugin/UltiSnips/__init__.py +++ b/plugin/UltiSnips/__init__.py @@ -359,7 +359,7 @@ class Snippet(object): line_ind = "" else: line_ind = indent - line_ind += tabs * self._util.sw * " " + line_ind += tabs * self._util.tab * " " line_ind = self._util.indent_to_spaces(line_ind) line_ind = self._util.spaces_to_indent(line_ind) v.append(line_ind + line[tabs:]) diff --git a/test.py b/test.py index 50fc478..27df84e 100755 --- a/test.py +++ b/test.py @@ -764,12 +764,10 @@ class TabStop_VimScriptInterpolation_SimpleExample(_VimTest): ############# class _ExpandTabs(_VimTest): def _options_on(self): - self.send(":set ts=3\n") - self.send(":set sw=3\n") + self.send(":set sts=3\n") self.send(":set expandtab\n") def _options_off(self): - self.send(":set ts=8\n") - self.send(":set sw=8\n") + self.send(":set sts=0\n") self.send(":set noexpandtab\n") class RecTabStopsWithExpandtab_SimpleExample_ECR(_ExpandTabs):