Lines Matching refs:vim

3 source check.vim
5 source shared.vim
21 import vim
34 cb = vim.current.buffer
39 …lass__ is AttributeError and str(e).find('has no attribute')>=0 and not str(e).startswith("'vim."):
62 … # Python 3.9 reports errors like "vim.command() takes ..." instead of "command() takes ..."
94 py3do vim.command("%d_")
101 py3do vim.command("new")
125 py3do vim.current.window.cursor = (1, 5)
134 " Check creating vim.Function object
142 py3 f = vim.bindeval('function("s:foo")')
149 py3 f = vim.Function(b'\x80\xfdR' + vim.eval('s:foo()').encode())
157 \ "Vim(let):AttributeError: 'vim.function' object has no attribute 'abc'")
166 python3 import vim
194 py3 vim.buffers[ int( vim.eval( 'bufnr("hidden")' ) ) ][:] = None
201 py3 vim.buffers[ int( vim.eval( 'bufnr("hidden")' ) ) ][:] = [ 'test' ]
208 py3 vim.buffers[ int( vim.eval( 'bufnr("hidden")' ) ) ][0] = 'test'
215 py3 vim.buffers[ int( vim.eval( 'bufnr("hidden")' ) ) ][0] = None
234 py3 vim.current.buffer[:] = None
243 py3 vim.current.buffer[:] = [ 'test' ]
252 py3 vim.current.buffer[-1] = None
286 " Test vim.eval() with various types.
288 call assert_equal("\n8", execute('py3 print(vim.eval("3+5"))'))
290 call assert_equal("\n3.140000", execute('py3 print(vim.eval("1.01+2.13"))'))
291 call assert_equal("\n0.000000", execute('py3 print(vim.eval("0.0/(1.0/0.0)"))'))
292 call assert_equal("\n0.000000", execute('py3 print(vim.eval("0.0/(1.0/0.0)"))'))
293 call assert_equal("\n-0.000000", execute('py3 print(vim.eval("0.0/(-1.0/0.0)"))'))
295 " call assert_equal("\ninf", execute('py3 print(vim.eval("1.0/0.0"))'))
296 " call assert_equal("\n-inf", execute('py3 print(vim.eval("-1.0/0.0"))'))
297 " call assert_equal("\n-nan", execute('py3 print(vim.eval("0.0/0.0"))'))
299 call assert_equal("\nabc", execute('py3 print(vim.eval("\"abc\""))'))
300 call assert_equal("\n['1', '2']", execute('py3 print(vim.eval("[1, 2]"))'))
301 call assert_equal("\n{'1': '2'}", execute('py3 print(vim.eval("{1:2}"))'))
302 call assert_equal("\nTrue", execute('py3 print(vim.eval("v:true"))'))
303 call assert_equal("\nFalse", execute('py3 print(vim.eval("v:false"))'))
304 call assert_equal("\nNone", execute('py3 print(vim.eval("v:null"))'))
305 call assert_equal("\nNone", execute('py3 print(vim.eval("v:none"))'))
306 call assert_equal("\nb'\\xab\\x12'", execute('py3 print(vim.eval("0zab12"))'))
308 call assert_fails('py3 vim.eval("1+")', 'E15: Invalid expression')
314 py3 b = vim.current.buffer
338 py3 vim.command("%d,%dnorm Ax" % (r.start + 1, r.end + 1))
362 py3 curbuf = vim.current.buffer
363 py3 curwin = vim.current.window
394 pyopt = vim.bindeval("opt")
395 vim.options[pyopt[0]] = pyopt[1]
416 pyopt = vim.bindeval("opt")
417 vim.options[pyopt[0]] = pyopt[1]
457 py3 b = vim.current.buffer
486 \ "Vim(let):AttributeError: 'vim.range' object has no attribute 'abc'")
494 py3 t = vim.tabpages[1]
499 \ 'Vim(let):vim.error: attempt to refer to deleted tab page')
501 \ 'Vim(let):vim.error: attempt to refer to deleted tab page')
503 \ 'Vim(py3):vim.error: attempt to refer to deleted tab page')
504 call AssertException(["py3 vim.current.tabpage = t"],
505 \ 'Vim(py3):vim.error: attempt to refer to deleted tab page')
514 py3 vim.current.window.height = 5
516 py3 vim.current.window.height = 3.2
521 py3 vim.current.window.width = 6
525 py3 w = vim.current.window
530 \ 'Vim(let):vim.error: attempt to refer to deleted window')
532 \ 'Vim(py3):vim.error: attempt to refer to deleted window')
533 call AssertException(["py3 vim.current.window = w"],
534 \ 'Vim(py3):vim.error: attempt to refer to deleted window')
538 \ 'Vim(py3):vim.error: attempt to refer to deleted window')
546 call AssertException(["py3 t = vim.eval('test_null_list()')"],
550 call AssertException(["py3 t = vim.eval('[test_null_list()]')"],
556 py3 ll = vim.bindeval('l')
561 py3 l = vim.bindeval('l')
562 py3 f = vim.bindeval('function("strlen")')
577 py3 ll = vim.bindeval('l')
582 py3 print([x for x in vim.Function("getline")(1, 2)])
592 call AssertException(["py3 t = vim.eval('test_null_dict()')"],
596 call AssertException(["py3 t = vim.eval(\"{'a' : test_null_list()}\")"],
600 py3 t = vim.eval("{test_null_string() : 10}")
605 py3 d = vim.bindeval('d')
619 py3 f = vim.bindeval('function("strlen")')
621 d = vim.bindeval('d')
638 \ 'Vim(py3):vim.error: dictionary is locked')
643 …call assert_equal("[-1, <vim.Function '1'>, <vim.dictionary object at >, <vim.list object at >, b'…
644 …ll assert_equal("[(b'-1', <vim.dictionary object at >), (b'0', -1), (b'1', b'asd'), (b'b', <vim.li…
655 py3 l = vim.bindeval('l')
660 py3 l = vim.bindeval('l')
669 py3 l = vim.bindeval('l')
678 py3 l = vim.bindeval('l')
683 py3 l = vim.bindeval('l')
688 py3 l = vim.bindeval('l')
694 py3 l = vim.bindeval('l')
703 py3 l = vim.bindeval('l')
708 py3 l = vim.bindeval('l')
713 py3 l = vim.bindeval('l')
718 py3 l = vim.bindeval('l')
723 py3 l = vim.bindeval('l')
728 py3 l = vim.bindeval('l')
735 py3 d = vim.bindeval('d')
757 py3 l = vim.bindeval('l')
762 py3 l = vim.bindeval('l')
767 py3 l = vim.bindeval('l')
772 py3 l = vim.bindeval('l')
777 py3 l = vim.bindeval('l')
782 py3 l = vim.bindeval('l')
787 py3 l = vim.bindeval('l')
792 py3 l = vim.bindeval('l')
797 py3 l = vim.bindeval('l')
802 py3 l = vim.bindeval('l')
807 py3 l = vim.bindeval('l')
812 py3 l = vim.bindeval('l')
817 py3 l = vim.bindeval('l')
828 py3 cb = vim.current.buffer
830 py3 l = vim.bindeval('l')
835 except vim.error:
836 cb.append('l[2] threw vim.error: ' + emsg(sys.exc_info()))
838 call assert_equal(['', "l[2] threw vim.error: error:('list is locked',)"],
842 call AssertException(['py3 l += [4, 5]'], 'Vim(py3):vim.error: list is locked')
861 py3 l = vim.bindeval('l')
869 …call assert_equal("l[1](1, 2, 3):(<class 'vim.error'>, error('Vim:E725: Calling dict function with…
874 …call assert_equal("f(1, 2, 3):(<class 'vim.error'>, error('Vim:E117: Unknown function: New',))", g…
882 py3 l = vim.bindeval('l')
892 d = vim.bindeval('{}')
893 m = vim.bindeval('messages')
905 em('d["abc1"]=vim')
926 execute 'py3 ' .. name .. ' = vim.bindeval("' .. s .. '")'
947 execute 'py3 ' .. name .. '=vim.bindeval("' .. s .. '")'
963 py3 a = vim.bindeval('v:argv')
980 py3 v = vim.eval('test_null_function()')
992 call AssertException(['let v = py3eval("vim")'], 'E859:')
995 " Test for vim.bindeval()
999 py3 f = vim.bindeval('f')
1004 py3 b = vim.bindeval('b')
1008 call assert_equal(1, py3eval("vim.bindeval('v:true')"))
1009 call assert_equal(0, py3eval("vim.bindeval('v:false')"))
1010 call assert_equal(v:none, py3eval("vim.bindeval('v:null')"))
1011 call assert_equal(v:none, py3eval("vim.bindeval('v:none')"))
1015 call assert_equal(v:none, py3eval("vim.bindeval('test_null_channel()')"))
1018 call assert_equal(v:none, py3eval("vim.bindeval('test_null_job()')"))
1027 py3 l = vim.bindeval('l')
1064 py3 l = vim.bindeval('l')
1088 py3 ll = vim.bindeval('[0, 1, 2, 3, 4, 5]')
1119 call AssertException(['py3 ll[-10] = 5'], 'Vim(py3):vim.error: internal error:')
1132 py3 ll = vim.bindeval('l')
1146 call assert_equal('Abc', py3eval('vim.vvars[''exception'']'))
1148 call assert_equal('bac', py3eval('vim.vars[''foo'']'))
1149 call assert_equal('def', py3eval('vim.current.window.vars[''abc3'']'))
1150 call assert_equal('bar', py3eval('vim.current.buffer.vars[''baz'']'))
1151 call assert_equal('jkl', py3eval('vim.current.tabpage.vars[''bar'']'))
1195 vim.command('return ' + repr(e.__class__.__name__))
1201 vim.command('let exc=' + repr(e.__class__.__name__))
1206 python3 e(vim.eval('a:s'))
1210 let r = py3eval('ev(vim.eval("a:s"))')
1217 py3 gopts1 = vim.options
1218 py3 wopts1 = vim.windows[2].options
1219 py3 wopts2 = vim.windows[0].options
1220 py3 wopts3 = vim.windows[1].options
1221 py3 bopts1 = vim.buffers[vim.bindeval("g:bufs")[2]].options
1222 py3 bopts2 = vim.buffers[vim.bindeval("g:bufs")[1]].options
1223 py3 bopts3 = vim.buffers[vim.bindeval("g:bufs")[0]].options
1247 py3 oname = vim.eval('oname')
1248 py3 oval1 = vim.bindeval('oval1')
1249 py3 oval2 = vim.bindeval('oval2')
1250 py3 oval3 = vim.bindeval('oval3')
1252 py3 invval = bool(vim.bindeval('invval'))
1254 py3 invval = vim.bindeval('invval')
1572 call assert_equal(0, py3eval("'' in vim.options"))
1574 " use an empty key to index vim.options
1575 call AssertException(["let v = py3eval(\"vim.options['']\")"],
1577 call AssertException(["py3 vim.current.window.options[''] = 0"],
1579 call AssertException(["py3 vim.current.window.options[{}] = 0"],
1583 let cmd = ["py3 vim.options['previewheight'] = 9999999999999999"]
1587 call AssertException(["py3 del vim.options['errorformat']"],
1591 " Test for vim.buffer object
1595 call assert_fails("let x = py3eval('vim.current.buffer[0]')", 'E859:')
1600 py3 cb = vim.current.buffer
1604 py3 b = vim.current.buffer
1673 vim.command('call append("$", getbufline(%i, 1, "$"))' % b.number)
1681 …autocmd BufFilePost * python3 cb.append(vim.eval('expand("<abuf>")') + ':BufFilePost:' + vim.eval(…
1682 …autocmd BufFilePre * python3 cb.append(vim.eval('expand("<abuf>")') + ':BufFilePre:' + vim.eval('b…
1708 for _b in vim.buffers:
1710 vim.command('bwipeout! ' + str(_b.number))
1721 except vim.error:
1727 vim.command('cd .')
1734 py3 vim.current.buffer[:] = []
1738 call assert_equal(v:none, py3eval("vim.current.buffer.mark('r')"))
1742 call AssertException(["py3 vim.current.buffer[0] = 'abc'"],
1743 \ "Vim(py3):vim.error: Vim:E21: Cannot make changes, 'modifiable' is off")
1744 call AssertException(["py3 vim.current.buffer[0] = None"],
1745 \ "Vim(py3):vim.error: Vim:E21: Cannot make changes, 'modifiable' is off")
1746 call AssertException(["py3 vim.current.buffer[:] = None"],
1747 \ "Vim(py3):vim.error: Vim:E21: Cannot make changes, 'modifiable' is off")
1748 call AssertException(["py3 vim.current.buffer[:] = []"],
1749 \ "Vim(py3):vim.error: Vim:E21: Cannot make changes, 'modifiable' is off")
1750 call AssertException(["py3 vim.current.buffer.append('abc')"],
1751 \ "Vim(py3):vim.error: Vim:E21: Cannot make changes, 'modifiable' is off")
1752 call AssertException(["py3 vim.current.buffer.append([])"],
1753 \ "Vim(py3):vim.error: Vim:E21: Cannot make changes, 'modifiable' is off")
1765 py3 b = vim.current.buffer
1766 py3 r = vim.current.buffer.range(0, 2)
1770 \ 'Vim(py3):vim.error: attempt to refer to deleted buffer')
1774 \ 'Vim(let):vim.error: attempt to refer to deleted buffer')
1776 \ 'Vim(py3):vim.error: attempt to refer to deleted buffer')
1780 \ 'Vim(py3):vim.error: attempt to refer to deleted buffer')
1782 \ 'Vim(py3):vim.error: attempt to refer to deleted buffer')
1784 \ 'Vim(let):vim.error: attempt to refer to deleted buffer')
1786 \ 'Vim(py3):vim.error: attempt to refer to deleted buffer')
1787 call AssertException(["py3 vim.current.buffer = b"],
1788 \ 'Vim(py3):vim.error: attempt to refer to deleted buffer')
1790 \ 'Vim(py3):vim.error: attempt to refer to deleted buffer')
1793 " Test vim.buffers object
1797 py3 cb = vim.current.buffer
1807 i = iter(vim.buffers)
1810 i2 = iter(vim.buffers)
1816 i3 = iter(vim.buffers)
1827 for b in vim.buffers:
1831 # Check indexing: vim.buffers[number].number == number
1832 cb.append(str(b.number) + ':' + repr(vim.buffers[b.number]) + \
1837 cb.append(str(len(vim.buffers)))
1846 bnums = list(map(lambda b: b.number, vim.buffers))[1:]
1849 i4 = iter(vim.buffers)
1851 vim.command('bwipeout! ' + str(bnums.pop(0)))
1854 except vim.error:
1857 cb.append('!!!! No vim.error')
1858 i4 = iter(vim.buffers)
1859 vim.command('bwipeout! ' + str(bnums.pop(-1)))
1860 vim.command('bwipeout! ' + str(bnums.pop(-1)))
1874 " Test vim.{tabpage,window}list and vim.{tabpage,window} objects
1878 py3 cb = vim.current.buffer
1888 cb.append('Number of tabs: ' + str(len(vim.tabpages)))
1902 for t in vim.tabpages:
1928 str(len(vim.windows)))
1929 if list(vim.windows) != list(vim.current.tabpage.windows):
1958 " Test vim.current
1962 py3 cb = vim.current.buffer
1974 cb.append('Current tab page: ' + repr(vim.current.tabpage))
1975 cb.append('Current window: ' + repr(vim.current.window) + ': ' + \
1976 H(vim.current.window) + ' is ' + H(vim.current.tabpage.window))
1977 cb.append('Current buffer: ' + repr(vim.current.buffer) + ': ' + \
1978 H(vim.current.buffer) + ' is ' + H(vim.current.window.buffer)+ \
1979 ' is ' + H(vim.current.tabpage.window.buffer))
1993 vim.current.window = vim.tabpages[0].window
1999 setattr(vim.current, attr, None)
2001 cb.append('Type error at assigning None to vim.current.' + attr)
2007 Type error at assigning None to vim.current.window
2008 Type error at assigning None to vim.current.tabpage
2009 Type error at assigning None to vim.current.buffer
2017 vim.current.tabpage = vim.tabpages[-2]
2018 vim.current.buffer = cb
2019 vim.current.window = vim.windows[0]
2020 vim.current.window.cursor = (len(vim.current.buffer), 0)
2021 cb.append('Current tab page: ' + repr(vim.current.tabpage))
2022 cb.append('Current window: ' + repr(vim.current.window))
2023 cb.append('Current buffer: ' + repr(vim.current.buffer))
2024 cb.append('Current line: ' + repr(vim.current.line))
2034 py3 vim.current.line = 'one line'
2039 ws = list(vim.windows)
2040 ts = list(vim.tabpages)
2041 for b in vim.buffers:
2043 vim.command('bwipeout! ' + str(b.number))
2063 py3 cb = vim.current.buffer
2066 ('vim.vars', 'Dictionary'),
2067 ('vim.options', 'Options'),
2068 ('vim.bindeval("{}")', 'Dictionary'),
2069 ('vim.bindeval("[]")', 'List'),
2070 ('vim.bindeval("function(\'tr\')")', 'Function'),
2071 ('vim.current.buffer', 'Buffer'),
2072 ('vim.current.range', 'Range'),
2073 ('vim.current.window', 'Window'),
2074 ('vim.current.tabpage', 'TabPage'),
2077 repr(type(eval(expr)) is getattr(vim, attr)))
2082 vim.vars:Dictionary:True
2083 vim.options:Options:True
2084 vim.bindeval("{}"):Dictionary:True
2085 vim.bindeval("[]"):List:True
2086 vim.bindeval("function('tr')"):Function:True
2087 vim.current.buffer:Buffer:True
2088 vim.current.range:Range:True
2089 vim.current.window:Window:True
2090 vim.current.tabpage:TabPage:True
2098 py3 cb = vim.current.buffer
2101 ('current', vim.current),
2102 ('buffer', vim.current.buffer),
2103 ('window', vim.current.window),
2104 ('tabpage', vim.current.tabpage),
2105 ('range', vim.current.range),
2106 ('dictionary', vim.bindeval('{}')),
2107 ('list', vim.bindeval('[]')),
2108 ('function', vim.bindeval('function("tr")')),
2129 " Test vim.*.__new__
2131 call assert_equal({}, py3eval('vim.Dictionary({})'))
2132 call assert_equal({'a': 1}, py3eval('vim.Dictionary(a=1)'))
2133 call assert_equal({'a': 1}, py3eval('vim.Dictionary(((''a'', 1),))'))
2134 call assert_equal([], py3eval('vim.List()'))
2135 call assert_equal(['a', 'b', 'c', '7'], py3eval('vim.List(iter(''abc7''))'))
2136 call assert_equal(function('tr'), py3eval('vim.Function(''tr'')'))
2138 \ py3eval('vim.Function(''tr'', args=[123, 3, 4])'))
2139 call assert_equal(function('tr'), py3eval('vim.Function(''tr'', args=[])'))
2141 \ py3eval('vim.Function(''tr'', self={})'))
2143 \ py3eval('vim.Function(''tr'', args=[123, 3, 4], self={})'))
2145 \ py3eval('vim.Function(''tr'', auto_rebind=False)'))
2147 \ py3eval('vim.Function(''tr'', args=[123, 3, 4], auto_rebind=False)'))
2149 \ py3eval('vim.Function(''tr'', args=[], auto_rebind=False)'))
2151 \ py3eval('vim.Function(''tr'', self={}, auto_rebind=False)'))
2153 \ py3eval('vim.Function(''tr'', args=[123, 3, 4], self={}, auto_rebind=False)'))
2156 " Test vim.Function
2168 py3 Pt = vim.bindeval('Pt')
2172 call assert_equal(3, py3eval('vim.strwidth("a\tb")'))
2175 py3 cb = vim.current.buffer
2184 line += '!result: ' + str(vim.Function('string')(ret), 'utf-8')
2186 a = vim.Function('Args')
2187 pa1 = vim.Function('Args', args=['abcArgsPA1'])
2188 pa2 = vim.Function('Args', args=[])
2189 pa3 = vim.Function('Args', args=['abcArgsPA3'], self={'abcSelfPA3': 'abcSelfPA3Val'})
2190 pa4 = vim.Function('Args', self={'abcSelfPA4': 'abcSelfPA4Val'})
2196 sa = vim.Function('SelfArgs')
2197 psa1 = vim.Function('SelfArgs', args=['abcArgsPSA1'])
2198 psa2 = vim.Function('SelfArgs', args=[])
2199 psa3 = vim.Function('SelfArgs', args=['abcArgsPSA3'], self={'abcSelfPSA3': 'abcSelfPSA3Val'})
2200 psa4 = vim.Function('SelfArgs', self={'abcSelfPSA4': 'abcSelfPSA4Val'})
2201 psa5 = vim.Function('SelfArgs', self={'abcSelfPSA5': 'abcSelfPSA5Val'}, auto_rebind=0)
2202 …psa6 = vim.Function('SelfArgs', args=['abcArgsPSA6'], self={'abcSelfPSA6': 'abcSelfPSA6Val'}, auto…
2203 psa7 = vim.Function('SelfArgs', args=['abcArgsPSA7'], auto_rebind=[])
2204 psa8 = vim.Function('SelfArgs', auto_rebind=False)
2205 psa9 = vim.Function('SelfArgs', self={'abcSelfPSA9': 'abcSelfPSA9Val'}, auto_rebind=True)
2206 …psaA = vim.Function('SelfArgs', args=['abcArgsPSAA'], self={'abcSelfPSAA': 'abcSelfPSAAVal'}, auto…
2207 psaB = vim.Function('SelfArgs', args=['abcArgsPSAB'], auto_rebind={'abcARPSAB': 'abcARPSABVal'})
2208 psaC = vim.Function('SelfArgs', auto_rebind=['abcARPSAC'])
2223 …psar = vim.Function('SelfArgs', args=[{'abcArgsPSAr': 'abcArgsPSArVal'}], self={'abcSelfPSAr': 'ab…
2236 a: <vim.Function 'Args'>
2237 pa1: <vim.Function 'Args', args=['abcArgsPA1']>
2238 pa2: <vim.Function 'Args'>
2239 pa3: <vim.Function 'Args', args=['abcArgsPA3'], self={'abcSelfPA3': 'abcSelfPA3Val'}>
2240 pa4: <vim.Function 'Args', self={'abcSelfPA4': 'abcSelfPA4Val'}>
2241 sa: <vim.Function 'SelfArgs'>
2242 psa1: <vim.Function 'SelfArgs', args=['abcArgsPSA1']>
2243 psa2: <vim.Function 'SelfArgs'>
2244 psa3: <vim.Function 'SelfArgs', args=['abcArgsPSA3'], self={'abcSelfPSA3': 'abcSelfPSA3Val'}>
2245 psa4: <vim.Function 'SelfArgs', self={'abcSelfPSA4': 'abcSelfPSA4Val'}>
2246 psa5: <vim.Function 'SelfArgs', self={'abcSelfPSA5': 'abcSelfPSA5Val'}>
2247 psa6: <vim.Function 'SelfArgs', args=['abcArgsPSA6'], self={'abcSelfPSA6': 'abcSelfPSA6Val'}>
2248 psa7: <vim.Function 'SelfArgs', args=['abcArgsPSA7']>
2249 psa8: <vim.Function 'SelfArgs'>
2250 psa9: <vim.Function 'SelfArgs', self={'abcSelfPSA9': 'abcSelfPSA9Val'}, auto_rebind=True>
2251 …psaA: <vim.Function 'SelfArgs', args=['abcArgsPSAA'], self={'abcSelfPSAA': 'abcSelfPSAAVal'}, auto…
2252 psaB: <vim.Function 'SelfArgs', args=['abcArgsPSAB']>
2253 psaC: <vim.Function 'SelfArgs'>
2254 …psar: <vim.Function 'SelfArgs', args=[{'abcArgsPSAr2': [{'rec': function('SelfArgs', [{...}], {...…
2351 return str(vim.Function('string')(v), 'utf-8')
2555 class DupDict(vim.Dictionary):
2562 class DupList(vim.List):
2570 class DupFun(vim.Function):
2600 py3 cb = vim.current.buffer
2603 fnamemodify = vim.Function('fnamemodify')
2605 cb.append(vim.eval('@%'))
2614 cb.append(vim.eval('@%')[len(path)+1:].replace(os.path.sep, '/'))
2619 cb.append(vim.eval('@%').replace(os.path.sep, '/'))
2623 cb.append(vim.eval('@%'))
2629 call AssertException(["py3 vim.chdir(None)"], "Vim(py3):TypeError:")
2641 py3 cb = vim.current.buffer
2645 d = vim.Dictionary()
2646 ned = vim.Dictionary(foo='bar', baz='abcD')
2647 dl = vim.Dictionary(a=1)
2649 l = vim.List()
2650 ll = vim.List('abcE')
2652 nel = vim.List('abcO')
2653 f = vim.Function('string')
2654 fd = vim.Function('F')
2655 fdel = vim.Function('D')
2656 vim.command('delfunction D')
2817 stringtochars_test('vim.command(%s)')
2818 ee('vim.command("", 2)')
2819 #! Not checked: vim->python exceptions translating: checked later
2823 stringtochars_test('vim.eval(%s)')
2824 ee('vim.eval("", FailingTrue())')
2827 stringtochars_test('vim.bindeval(%s)')
2828 ee('vim.eval("", 2)')
2829 #! Not checked: vim->python exceptions translating: checked later
2831 stringtochars_test('vim.strwidth(%s)')
2833 ee('vim.foreach_rtp(None)')
2834 ee('vim.foreach_rtp(NoArgsCall())')
2835 ee('vim.foreach_rtp(FailingCall())')
2836 ee('vim.foreach_rtp(int, 2)')
2838 old_rtp = vim.options['rtp']
2839 vim.options['rtp'] = os.getcwd().replace('\\', '\\\\').replace(',', '\\,')
2843 vim.options['rtp'] = old_rtp
2847 ee('vim.options["abcQ"]')
2848 ee('vim.options[""]')
2849 stringtochars_test('vim.options[%s]')
2851 stringtochars_test('%s in vim.options')
2854 ee('vim.Dictionary("abcI")')
2859 ee('vim.vvars.locked = False')
2893 ee('vim.List(1, 2)')
2894 ee('vim.List(a=1)')
2895 iter_test('vim.List(%s)')
2896 convertfrompyobject_test('vim.List([%s])')
2924 ee('vim.Function("123")')
2925 ee('vim.Function("xxx_non_existent_function_xxx")')
2926 ee('vim.Function("xxx#non#existent#function#xxx")')
2927 ee('vim.Function("xxx_non_existent_function_xxx2", args=[])')
2928 ee('vim.Function("xxx_non_existent_function_xxx3", self={})')
2929 ee('vim.Function("xxx_non_existent_function_xxx4", args=[], self={})')
2931 ee('vim.Function("tr", self="abcFuncSelf")')
2932 ee('vim.Function("tr", args=427423)')
2933 ee('vim.Function("tr", self="abcFuncSelf2", args="abcFuncArgs2")')
2934 ee('vim.Function(self="abcFuncSelf2", args="abcFuncArgs2")')
2935 ee('vim.Function("tr", "", self="abcFuncSelf2", args="abcFuncArgs2")')
2936 ee('vim.Function("tr", "")')
2942 ee('vim.current.tabpage.xxx')
2945 ee('vim.tabpages[1000]')
2948 ee('vim.current.window.xxx')
2950 ee('vim.current.window.buffer = 0')
2951 ee('vim.current.window.cursor = (100000000, 100000000)')
2952 ee('vim.current.window.cursor = True')
2953 number_test('vim.current.window.height = %s', unsigned=True)
2954 number_test('vim.current.window.width = %s', unsigned=True)
2955 ee('vim.current.window.xxxxxx = True')
2958 ee('vim.windows[1000]')
2961 ee('vim.current.buffer[0] = "\\na"')
2962 ee('vim.current.buffer[0] = b"\\na"')
2964 ee('vim.current.buffer[0] = True')
2966 ee('vim.current.buffer[:] = True')
2967 ee('vim.current.buffer[:] = ["\\na", "bc"]')
2969 ee('vim.current.buffer.append(None)')
2970 ee('vim.current.buffer.append(["\\na", "bc"])')
2971 ee('vim.current.buffer.append("\\nbc")')
2973 ee('vim.current.buffer[100000000]')
2975 ee('vim.current.buffer[100000000] = ""')
2977 ee('vim.current.buffer.xxx')
2979 ee('vim.current.buffer.name = True')
2980 ee('vim.current.buffer.xxx = True')
2982 ee('vim.current.buffer.mark(0)')
2983 ee('vim.current.buffer.mark("abcM")')
2984 ee('vim.current.buffer.mark("!")')
2986 ee('vim.current.buffer.range(1, 2, 3)')
2989 ee('vim.buffers[100000000]')
2990 number_test('vim.buffers[%s]', natural=True)
2993 ee('vim.current.xxx')
2995 ee('vim.current.line = True')
2996 ee('vim.current.buffer = True')
2997 ee('vim.current.window = True')
2998 ee('vim.current.tabpage = True')
2999 ee('vim.current.xxx = True')
3071 >>> Testing StringToChars using vim.command(%s)
3072vim.command(1):(<class 'TypeError'>, TypeError('expected bytes() or str() instance, but got int',))
3073 vim.command(b"\0"):(<class 'TypeError'>, TypeError('expected bytes with no null',))
3074 vim.command("\0"):(<class 'TypeError'>, TypeError('expected bytes with no null',))
3076vim.command("", 2):(<class 'TypeError'>, TypeError('command() takes exactly one argument (2 given)…
3079 >>> Testing StringToChars using vim.eval(%s)
3080 vim.eval(1):(<class 'TypeError'>, TypeError('expected bytes() or str() instance, but got int',))
3081 vim.eval(b"\0"):(<class 'TypeError'>, TypeError('expected bytes with no null',))
3082 vim.eval("\0"):(<class 'TypeError'>, TypeError('expected bytes with no null',))
3084vim.eval("", FailingTrue()):(<class 'TypeError'>, TypeError('function takes exactly 1 argument (2 …
3086 >>> Testing StringToChars using vim.bindeval(%s)
3087vim.bindeval(1):(<class 'TypeError'>, TypeError('expected bytes() or str() instance, but got int',…
3088 vim.bindeval(b"\0"):(<class 'TypeError'>, TypeError('expected bytes with no null',))
3089 vim.bindeval("\0"):(<class 'TypeError'>, TypeError('expected bytes with no null',))
3091 vim.eval("", 2):(<class 'TypeError'>, TypeError('function takes exactly 1 argument (2 given)',))
3093 >>> Testing StringToChars using vim.strwidth(%s)
3094vim.strwidth(1):(<class 'TypeError'>, TypeError('expected bytes() or str() instance, but got int',…
3095 vim.strwidth(b"\0"):(<class 'TypeError'>, TypeError('expected bytes with no null',))
3096 vim.strwidth("\0"):(<class 'TypeError'>, TypeError('expected bytes with no null',))
3099 vim.foreach_rtp(None):(<class 'TypeError'>, TypeError("'NoneType' object is not callable",))
3100vim.foreach_rtp(NoArgsCall()):(<class 'TypeError'>, TypeError('__call__() takes exactly 1 position…
3101 vim.foreach_rtp(FailingCall()):(<class 'NotImplementedError'>, NotImplementedError('call',))
3102vim.foreach_rtp(int, 2):(<class 'TypeError'>, TypeError('foreach_rtp() takes exactly one argument …
3109 vim.options["abcQ"]:(<class 'KeyError'>, KeyError('abcQ',))
3110 vim.options[""]:(<class 'ValueError'>, ValueError('empty keys are not allowed',))
3111 >>> Testing StringToChars using vim.options[%s]
3112vim.options[1]:(<class 'TypeError'>, TypeError('expected bytes() or str() instance, but got int',))
3113 vim.options[b"\0"]:(<class 'TypeError'>, TypeError('expected bytes with no null',))
3114 vim.options["\0"]:(<class 'TypeError'>, TypeError('expected bytes with no null',))
3117 >>> Testing StringToChars using %s in vim.options
3118 …1 in vim.options:(<class 'TypeError'>, TypeError('expected bytes() or str() instance, but got int'…
3119 b"\0" in vim.options:(<class 'TypeError'>, TypeError('expected bytes with no null',))
3120 "\0" in vim.options:(<class 'TypeError'>, TypeError('expected bytes with no null',))
3124vim.Dictionary("abcI"):(<class 'ValueError'>, ValueError('expected sequence element of size 2, but…
3126 …del d.locked:(<class 'AttributeError'>, AttributeError('cannot delete vim.Dictionary attributes',))
3128 vim.vvars.locked = False:(<class 'TypeError'>, TypeError('cannot modify fixed dictionary',))
3139 dl.pop("a"):(<class 'vim.error'>, error('dictionary is locked',))
3146 dl["b"] = 1:(<class 'vim.error'>, error('dictionary is locked',))
3319 …d.update((("a", {"abcF" : None}),)):(<class 'vim.error'>, error("failed to add key 'a' to dictiona…
3346 …d.update((("a", Mapping({"abcG" : None})),)):(<class 'vim.error'>, error("failed to add key 'a' to…
3358 d.update((("a", None),)):(<class 'vim.error'>, error("failed to add key 'a' to dictionary",))
3371 vim.List(1, 2):(<class 'TypeError'>, TypeError('function takes at most 1 argument (2 given)',))
3372vim.List(a=1):(<class 'TypeError'>, TypeError('list constructor does not accept keyword arguments'…
3373 >>> Testing *Iter* using vim.List(%s)
3374 vim.List(FailingIter()):(<class 'NotImplementedError'>, NotImplementedError('iter',))
3375 vim.List(FailingIterNext()):(<class 'NotImplementedError'>, NotImplementedError('next',))
3377 >>> Testing StringToChars using vim.List([{%s : 1}])
3378vim.List([{1 : 1}]):(<class 'TypeError'>, TypeError('expected bytes() or str() instance, but got i…
3379 vim.List([{b"\0" : 1}]):(<class 'TypeError'>, TypeError('expected bytes with no null',))
3380 vim.List([{"\0" : 1}]):(<class 'TypeError'>, TypeError('expected bytes with no null',))
3382 >>> Testing StringToChars using vim.List([{"abcF" : {%s : 1}}])
3383vim.List([{"abcF" : {1 : 1}}]):(<class 'TypeError'>, TypeError('expected bytes() or str() instance…
3384vim.List([{"abcF" : {b"\0" : 1}}]):(<class 'TypeError'>, TypeError('expected bytes with no null',))
3385vim.List([{"abcF" : {"\0" : 1}}]):(<class 'TypeError'>, TypeError('expected bytes with no null',))
3387 >>> Testing StringToChars using vim.List([{"abcF" : Mapping({%s : 1})}])
3388vim.List([{"abcF" : Mapping({1 : 1})}]):(<class 'TypeError'>, TypeError('expected bytes() or str()…
3389vim.List([{"abcF" : Mapping({b"\0" : 1})}]):(<class 'TypeError'>, TypeError('expected bytes with n…
3390vim.List([{"abcF" : Mapping({"\0" : 1})}]):(<class 'TypeError'>, TypeError('expected bytes with no…
3392 >>> Testing *Iter* using vim.List([{"abcF" : %s}])
3393vim.List([{"abcF" : FailingIter()}]):(<class 'TypeError'>, TypeError('unable to convert FailingIte…
3394vim.List([{"abcF" : FailingIterNext()}]):(<class 'NotImplementedError'>, NotImplementedError('next…
3396 >>> Testing ConvertFromPyObject using vim.List([{"abcF" : %s}])
3397 vim.List([{"abcF" : None}]):NOT FAILED
3398vim.List([{"abcF" : {b"": 1}}]):(<class 'ValueError'>, ValueError('empty keys are not allowed',))
3399 vim.List([{"abcF" : {"": 1}}]):(<class 'ValueError'>, ValueError('empty keys are not allowed',))
3400vim.List([{"abcF" : FailingMapping()}]):(<class 'NotImplementedError'>, NotImplementedError('keys'…
3401vim.List([{"abcF" : FailingMappingKey()}]):(<class 'NotImplementedError'>, NotImplementedError('ge…
3402vim.List([{"abcF" : FailingNumber()}]):(<class 'NotImplementedError'>, NotImplementedError('int',))
3404 >>> Testing StringToChars using vim.List([Mapping({%s : 1})])
3405vim.List([Mapping({1 : 1})]):(<class 'TypeError'>, TypeError('expected bytes() or str() instance, …
3406vim.List([Mapping({b"\0" : 1})]):(<class 'TypeError'>, TypeError('expected bytes with no null',))
3407 vim.List([Mapping({"\0" : 1})]):(<class 'TypeError'>, TypeError('expected bytes with no null',))
3409 >>> Testing StringToChars using vim.List([Mapping({"abcG" : {%s : 1}})])
3410vim.List([Mapping({"abcG" : {1 : 1}})]):(<class 'TypeError'>, TypeError('expected bytes() or str()…
3411vim.List([Mapping({"abcG" : {b"\0" : 1}})]):(<class 'TypeError'>, TypeError('expected bytes with n…
3412vim.List([Mapping({"abcG" : {"\0" : 1}})]):(<class 'TypeError'>, TypeError('expected bytes with no…
3414 >>> Testing StringToChars using vim.List([Mapping({"abcG" : Mapping({%s : 1})})])
3415vim.List([Mapping({"abcG" : Mapping({1 : 1})})]):(<class 'TypeError'>, TypeError('expected bytes()…
3416vim.List([Mapping({"abcG" : Mapping({b"\0" : 1})})]):(<class 'TypeError'>, TypeError('expected byt…
3417vim.List([Mapping({"abcG" : Mapping({"\0" : 1})})]):(<class 'TypeError'>, TypeError('expected byte…
3419 >>> Testing *Iter* using vim.List([Mapping({"abcG" : %s})])
3420vim.List([Mapping({"abcG" : FailingIter()})]):(<class 'TypeError'>, TypeError('unable to convert F…
3421vim.List([Mapping({"abcG" : FailingIterNext()})]):(<class 'NotImplementedError'>, NotImplementedEr…
3423 >>> Testing ConvertFromPyObject using vim.List([Mapping({"abcG" : %s})])
3424 vim.List([Mapping({"abcG" : None})]):NOT FAILED
3425vim.List([Mapping({"abcG" : {b"": 1}})]):(<class 'ValueError'>, ValueError('empty keys are not all…
3426vim.List([Mapping({"abcG" : {"": 1}})]):(<class 'ValueError'>, ValueError('empty keys are not allo…
3427vim.List([Mapping({"abcG" : FailingMapping()})]):(<class 'NotImplementedError'>, NotImplementedErr…
3428vim.List([Mapping({"abcG" : FailingMappingKey()})]):(<class 'NotImplementedError'>, NotImplemented…
3429vim.List([Mapping({"abcG" : FailingNumber()})]):(<class 'NotImplementedError'>, NotImplementedErro…
3431 >>> Testing *Iter* using vim.List([%s])
3432vim.List([FailingIter()]):(<class 'TypeError'>, TypeError('unable to convert FailingIter to a Vim …
3433 vim.List([FailingIterNext()]):(<class 'NotImplementedError'>, NotImplementedError('next',))
3435 >>> Testing ConvertFromPyObject using vim.List([%s])
3436 vim.List([None]):NOT FAILED
3437 vim.List([{b"": 1}]):(<class 'ValueError'>, ValueError('empty keys are not allowed',))
3438 vim.List([{"": 1}]):(<class 'ValueError'>, ValueError('empty keys are not allowed',))
3439 vim.List([FailingMapping()]):(<class 'NotImplementedError'>, NotImplementedError('keys',))
3440vim.List([FailingMappingKey()]):(<class 'NotImplementedError'>, NotImplementedError('getitem:mappi…
3441 vim.List([FailingNumber()]):(<class 'NotImplementedError'>, NotImplementedError('int',))
3446 ll[1] = 2:(<class 'vim.error'>, error('list is locked',))
3449 ll[1:100] = "abcJ":(<class 'vim.error'>, error('list is locked',))
3600 del l.locked:(<class 'AttributeError'>, AttributeError('cannot delete vim.List attributes',))
3606 vim.Function("123"):(<class 'ValueError'>, ValueError('unnamed function 123 does not exist',))
3607vim.Function("xxx_non_existent_function_xxx"):(<class 'ValueError'>, ValueError('function xxx_non_…
3608 vim.Function("xxx#non#existent#function#xxx"):NOT FAILED
3609vim.Function("xxx_non_existent_function_xxx2", args=[]):(<class 'ValueError'>, ValueError('functio…
3610vim.Function("xxx_non_existent_function_xxx3", self={}):(<class 'ValueError'>, ValueError('functio…
3611vim.Function("xxx_non_existent_function_xxx4", args=[], self={}):(<class 'ValueError'>, ValueError…
3613 vim.Function("tr", self="abcFuncSelf"):(<class 'AttributeError'>, AttributeError('keys',))
3614vim.Function("tr", args=427423):(<class 'TypeError'>, TypeError('unable to convert int to a Vim li…
3615vim.Function("tr", self="abcFuncSelf2", args="abcFuncArgs2"):(<class 'AttributeError'>, AttributeE…
3616vim.Function(self="abcFuncSelf2", args="abcFuncArgs2"):(<class 'AttributeError'>, AttributeError('…
3617vim.Function("tr", "", self="abcFuncSelf2", args="abcFuncArgs2"):(<class 'AttributeError'>, Attrib…
3618vim.Function("tr", ""):(<class 'TypeError'>, TypeError('function takes exactly 1 argument (2 given…
3757vim.current.tabpage.xxx:(<class 'AttributeError'>, AttributeError("'vim.tabpage' object has no att…
3760 vim.tabpages[1000]:(<class 'IndexError'>, IndexError('no such tab page',))
3763vim.current.window.xxx:(<class 'AttributeError'>, AttributeError("'vim.window' object has no attri…
3765 vim.current.window.buffer = 0:(<class 'TypeError'>, TypeError('readonly attribute: buffer',))
3766vim.current.window.cursor = (100000000, 100000000):(<class 'vim.error'>, error('cursor position ou…
3767vim.current.window.cursor = True:(<class 'TypeError'>, TypeError('argument must be 2-item sequence…
3768 >>> Testing NumberToLong using vim.current.window.height = %s
3769vim.current.window.height = []:(<class 'TypeError'>, TypeError('expected int() or something suppor…
3770vim.current.window.height = None:(<class 'TypeError'>, TypeError('expected int() or something supp…
3771vim.current.window.height = -1:(<class 'ValueError'>, ValueError('number must be greater or equal …
3773 >>> Testing NumberToLong using vim.current.window.width = %s
3774vim.current.window.width = []:(<class 'TypeError'>, TypeError('expected int() or something support…
3775vim.current.window.width = None:(<class 'TypeError'>, TypeError('expected int() or something suppo…
3776vim.current.window.width = -1:(<class 'ValueError'>, ValueError('number must be greater or equal t…
3778 vim.current.window.xxxxxx = True:(<class 'AttributeError'>, AttributeError('xxxxxx',))
3781 vim.windows[1000]:(<class 'IndexError'>, IndexError('no such window',))
3784 vim.current.buffer[0] = "\na":(<class 'vim.error'>, error('string cannot contain newlines',))
3785 vim.current.buffer[0] = b"\na":(<class 'vim.error'>, error('string cannot contain newlines',))
3787vim.current.buffer[0] = True:(<class 'TypeError'>, TypeError('bad argument type for built-in opera…
3789vim.current.buffer[:] = True:(<class 'TypeError'>, TypeError('bad argument type for built-in opera…
3790vim.current.buffer[:] = ["\na", "bc"]:(<class 'vim.error'>, error('string cannot contain newlines'…
3792vim.current.buffer.append(None):(<class 'TypeError'>, TypeError('bad argument type for built-in op…
3793vim.current.buffer.append(["\na", "bc"]):(<class 'vim.error'>, error('string cannot contain newlin…
3794vim.current.buffer.append("\nbc"):(<class 'vim.error'>, error('string cannot contain newlines',))
3796 vim.current.buffer[100000000]:(<class 'IndexError'>, IndexError('line number out of range',))
3798vim.current.buffer[100000000] = "":(<class 'IndexError'>, IndexError('line number out of range',))
3800vim.current.buffer.xxx:(<class 'AttributeError'>, AttributeError("'vim.buffer' object has no attri…
3802vim.current.buffer.name = True:(<class 'TypeError'>, TypeError('expected bytes() or str() instance…
3803 vim.current.buffer.xxx = True:(<class 'AttributeError'>, AttributeError('xxx',))
3805vim.current.buffer.mark(0):(<class 'TypeError'>, TypeError('expected bytes() or str() instance, bu…
3806vim.current.buffer.mark("abcM"):(<class 'ValueError'>, ValueError('mark name must be a single char…
3807 vim.current.buffer.mark("!"):(<class 'vim.error'>, error('invalid mark name',))
3809vim.current.buffer.range(1, 2, 3):(<class 'TypeError'>, TypeError('function takes exactly 2 argume…
3812 vim.buffers[100000000]:(<class 'KeyError'>, KeyError(100000000,))
3813 >>> Testing NumberToLong using vim.buffers[%s]
3814vim.buffers[[]]:(<class 'TypeError'>, TypeError('expected int() or something supporting coercing t…
3815vim.buffers[None]:(<class 'TypeError'>, TypeError('expected int() or something supporting coercing…
3816 vim.buffers[-1]:(<class 'ValueError'>, ValueError('number must be greater than zero',))
3817 vim.buffers[0]:(<class 'ValueError'>, ValueError('number must be greater than zero',))
3821vim.current.xxx:(<class 'AttributeError'>, AttributeError("'vim.currentdata' object has no attribu…
3823vim.current.line = True:(<class 'TypeError'>, TypeError('bad argument type for built-in operation'…
3824vim.current.buffer = True:(<class 'TypeError'>, TypeError('expected vim.Buffer object, but got boo…
3825vim.current.window = True:(<class 'TypeError'>, TypeError('expected vim.Window object, but got boo…
3826vim.current.tabpage = True:(<class 'TypeError'>, TypeError('expected vim.TabPage object, but got b…
3827 vim.current.xxx = True:(<class 'AttributeError'>, AttributeError('xxx',))
3846 py3 cb = vim.current.buffer
3851 vim.options['rtp'] = os.getcwd().replace(',', '\\,').replace('\\', '\\\\')
3855 vim.foreach_rtp(callback)
3860 cb.append(repr(vim.foreach_rtp(callback)))
3909 py3 cb = vim.current.buffer
3912 Exe = vim.bindeval('function("Exe")')
3913 ee('vim.command("throw \'abcN\'")')
3915 ee('vim.eval("Exe(\'throw \'\'ghi\'\'\')")')
3916 ee('vim.eval("Exe(\'echoerr \'\'jkl\'\'\')")')
3917 ee('vim.eval("Exe(\'xxx_non_existent_command_xxx\')")')
3918 ee('vim.eval("xxx_unknown_function_xxx()")')
3919 ee('vim.bindeval("Exe(\'xxx_non_existent_command_xxx\')")')
3925 vim.command("throw 'abcN'"):(<class 'vim.error'>, error('abcN',))
3926 Exe("throw 'def'"):(<class 'vim.error'>, error('def',))
3927 vim.eval("Exe('throw ''ghi''')"):(<class 'vim.error'>, error('ghi',))
3928 vim.eval("Exe('echoerr ''jkl''')"):(<class 'vim.error'>, error('Vim(echoerr):jkl',))
3929vim.eval("Exe('xxx_non_existent_command_xxx')"):(<class 'vim.error'>, error('Vim:E492: Not an edit…
3930vim.eval("xxx_unknown_function_xxx()"):(<class 'vim.error'>, error('Vim:E117: Unknown function: xx…
3931vim.bindeval("Exe('xxx_non_existent_command_xxx')"):(<class 'vim.error'>, error('Vim:E492: Not an …
3937 " Regression: interrupting vim.command propagates to next vim.command
3940 py3 cb = vim.current.buffer
3944 vim.command('while 1 | endwhile')
3952 vim.command('$ put =\'Running :put\'')
3990 import vim
3993 create_list = vim.Function('Create_vim_list')
3997 vim.vars['list_iter_ref_count_increase'] = sys.getrefcount(v) - base_ref_count
3999 create_dict = vim.Function('Create_vim_dict')
4003 vim.vars['dict_iter_ref_count_increase'] = sys.getrefcount(v) - base_ref_count
4005 v = vim.buffers
4008 vim.vars['bufmap_iter_ref_count_increase'] = sys.getrefcount(v) - base_ref_count
4010 v = vim.options
4013 vim.vars['options_iter_ref_count_increase'] = sys.getrefcount(v) - base_ref_count
4026 py3 vim.command('redir => _tmp_smaps | smap | redir END')
4027 py3 vim.eval('_tmp_smaps').splitlines()
4052 py3 import vim
4053 py3 b = vim.current.buffer
4064 " vim: shiftwidth=2 sts=2 expandtab