use sts instead of sw for initial tabs
This commit is contained in:
parent
c20c76be71
commit
23924c3249
@ -17,6 +17,8 @@ class IndentUtil(object):
|
|||||||
self.et = (vim.eval("&expandtab") == "1")
|
self.et = (vim.eval("&expandtab") == "1")
|
||||||
self.ts = int(vim.eval("&ts"))
|
self.ts = int(vim.eval("&ts"))
|
||||||
|
|
||||||
|
self.tab = self.sts or self.ts
|
||||||
|
|
||||||
def indent_to_spaces(self, indent):
|
def indent_to_spaces(self, indent):
|
||||||
""" Converts indentation to spaces respecting vim settings. """
|
""" Converts indentation to spaces respecting vim settings. """
|
||||||
indent = indent.replace(" " * self.ts, "\t")
|
indent = indent.replace(" " * self.ts, "\t")
|
||||||
|
@ -359,7 +359,7 @@ class Snippet(object):
|
|||||||
line_ind = ""
|
line_ind = ""
|
||||||
else:
|
else:
|
||||||
line_ind = indent
|
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.indent_to_spaces(line_ind)
|
||||||
line_ind = self._util.spaces_to_indent(line_ind)
|
line_ind = self._util.spaces_to_indent(line_ind)
|
||||||
v.append(line_ind + line[tabs:])
|
v.append(line_ind + line[tabs:])
|
||||||
|
6
test.py
6
test.py
@ -764,12 +764,10 @@ class TabStop_VimScriptInterpolation_SimpleExample(_VimTest):
|
|||||||
#############
|
#############
|
||||||
class _ExpandTabs(_VimTest):
|
class _ExpandTabs(_VimTest):
|
||||||
def _options_on(self):
|
def _options_on(self):
|
||||||
self.send(":set ts=3\n")
|
self.send(":set sts=3\n")
|
||||||
self.send(":set sw=3\n")
|
|
||||||
self.send(":set expandtab\n")
|
self.send(":set expandtab\n")
|
||||||
def _options_off(self):
|
def _options_off(self):
|
||||||
self.send(":set ts=8\n")
|
self.send(":set sts=0\n")
|
||||||
self.send(":set sw=8\n")
|
|
||||||
self.send(":set noexpandtab\n")
|
self.send(":set noexpandtab\n")
|
||||||
|
|
||||||
class RecTabStopsWithExpandtab_SimpleExample_ECR(_ExpandTabs):
|
class RecTabStopsWithExpandtab_SimpleExample_ECR(_ExpandTabs):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user