From cce79fda0eb0c78dcc06d3beb62e1d8f2d3ec01a Mon Sep 17 00:00:00 2001 From: ZyX Date: Sat, 13 Apr 2013 19:28:19 +0400 Subject: [PATCH] Add support for getbufvar('%') and &textwidth option to vim emulation --- tests/vim.py | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/tests/vim.py b/tests/vim.py index aaf5e534..41186b70 100644 --- a/tests/vim.py +++ b/tests/vim.py @@ -196,6 +196,8 @@ def _emul_mode(*args): @_str_func def _emul_getbufvar(bufnr, varname): if varname[0] == '&': + if bufnr == '%': + bufnr = buffers[_buffer()].number if bufnr not in buffers: return '' try: @@ -316,13 +318,14 @@ class _Buffer(object): self.name = os.path.abspath(name) if name else None _buf_scopes[bufnr] = {} _buf_options[bufnr] = { - 'modified': 0, - 'readonly': 0, - 'fileformat': 'unix', - 'filetype': '', - 'buftype': '', - 'fileencoding': 'utf-8', - } + 'modified': 0, + 'readonly': 0, + 'fileformat': 'unix', + 'filetype': '', + 'buftype': '', + 'fileencoding': 'utf-8', + 'textwidth': 80, + } _buf_lines[bufnr] = [''] from copy import copy _undostate[bufnr] = [copy(_buf_lines[bufnr])]