Add support for getbufvar('%') and &textwidth option to vim emulation
This commit is contained in:
parent
1ffa8a471a
commit
cce79fda0e
17
tests/vim.py
17
tests/vim.py
|
@ -196,6 +196,8 @@ def _emul_mode(*args):
|
||||||
@_str_func
|
@_str_func
|
||||||
def _emul_getbufvar(bufnr, varname):
|
def _emul_getbufvar(bufnr, varname):
|
||||||
if varname[0] == '&':
|
if varname[0] == '&':
|
||||||
|
if bufnr == '%':
|
||||||
|
bufnr = buffers[_buffer()].number
|
||||||
if bufnr not in buffers:
|
if bufnr not in buffers:
|
||||||
return ''
|
return ''
|
||||||
try:
|
try:
|
||||||
|
@ -316,13 +318,14 @@ class _Buffer(object):
|
||||||
self.name = os.path.abspath(name) if name else None
|
self.name = os.path.abspath(name) if name else None
|
||||||
_buf_scopes[bufnr] = {}
|
_buf_scopes[bufnr] = {}
|
||||||
_buf_options[bufnr] = {
|
_buf_options[bufnr] = {
|
||||||
'modified': 0,
|
'modified': 0,
|
||||||
'readonly': 0,
|
'readonly': 0,
|
||||||
'fileformat': 'unix',
|
'fileformat': 'unix',
|
||||||
'filetype': '',
|
'filetype': '',
|
||||||
'buftype': '',
|
'buftype': '',
|
||||||
'fileencoding': 'utf-8',
|
'fileencoding': 'utf-8',
|
||||||
}
|
'textwidth': 80,
|
||||||
|
}
|
||||||
_buf_lines[bufnr] = ['']
|
_buf_lines[bufnr] = ['']
|
||||||
from copy import copy
|
from copy import copy
|
||||||
_undostate[bufnr] = [copy(_buf_lines[bufnr])]
|
_undostate[bufnr] = [copy(_buf_lines[bufnr])]
|
||||||
|
|
Loading…
Reference in New Issue