Add field numbers to avoid errors in Python 2.6

This commit is contained in:
Hans Chen 2015-08-05 10:39:19 -04:00
parent ffb9b79480
commit 44644f1fd5

View File

@ -76,11 +76,11 @@ buf = VimBuffer() # pylint:disable=invalid-name
@contextmanager @contextmanager
def toggle_opt(name, new_value): def toggle_opt(name, new_value):
old_value = eval('&' + name) old_value = eval('&' + name)
command('set {}={}'.format(name, new_value)) command('set {0}={1}'.format(name, new_value))
try: try:
yield yield
finally: finally:
command('set {}={}'.format(name, old_value)) command('set {0}={1}'.format(name, old_value))
@contextmanager @contextmanager
def save_mark(name): def save_mark(name):
@ -217,10 +217,10 @@ def delete_mark(name):
return False return False
def _set_pos(name, pos): def _set_pos(name, pos):
return eval("setpos(\"{}\", {})".format(name, pos)) return eval("setpos(\"{0}\", {1})".format(name, pos))
def _get_pos(name): def _get_pos(name):
return eval("getpos(\"{}\")".format(name)) return eval("getpos(\"{0}\")".format(name))
def _is_pos_zero(pos): def _is_pos_zero(pos):
return ['0'] * 4 == pos or [0] == pos return ['0'] * 4 == pos or [0] == pos