diff options
-rw-r--r-- | runtime/doc/eval.txt | 25 | ||||
-rw-r--r-- | src/nvim/eval.lua | 14 | ||||
-rw-r--r-- | src/nvim/testdir/test_bufwintabinfo.vim | 2 | ||||
-rw-r--r-- | src/nvim/testdir/test_escaped_glob.vim | 6 | ||||
-rw-r--r-- | src/nvim/testdir/test_getvar.vim | 4 | ||||
-rw-r--r-- | src/nvim/testdir/test_glob2regpat.vim | 2 | ||||
-rw-r--r-- | src/nvim/testdir/test_tagjump.vim | 2 |
7 files changed, 38 insertions, 17 deletions
diff --git a/runtime/doc/eval.txt b/runtime/doc/eval.txt index 24b6e6da6d..ffc6221818 100644 --- a/runtime/doc/eval.txt +++ b/runtime/doc/eval.txt @@ -5477,7 +5477,7 @@ gettabwinvar({tabnr}, {winnr}, {varname} [, {def}]) *gettabwinvar()* gettabwinvar({tabnr}, {winnr}, '&') < Can also be used as a |method|: > - GetTabnr()->gettabvar(winnr, varname) + GetTabnr()->gettabwinvar(winnr, varname) gettagstack([{winnr}]) *gettagstack()* The result is a Dict, which is the tag stack of window {winnr}. @@ -5507,6 +5507,9 @@ gettagstack([{winnr}]) *gettagstack()* See |tagstack| for more information about the tag stack. + Can also be used as a |method|: > + GetWinnr()->gettagstack() + getwininfo([{winid}]) *getwininfo()* Returns information about windows as a |List| with Dictionaries. @@ -5538,6 +5541,9 @@ getwininfo([{winid}]) *getwininfo()* winrow topmost screen line of the window; "row" from |win_screenpos()| + Can also be used as a |method|: > + GetWinnr()->getwininfo() + getwinpos([{timeout}]) *getwinpos()* The result is a |List| with two numbers, the result of |getwinposx()| and |getwinposy()| combined: @@ -5558,6 +5564,9 @@ getwinpos([{timeout}]) *getwinpos()* " Do some work here endwhile < + Can also be used as a |method|: > + GetTimeout()->getwinpos() +< *getwinposx()* getwinposx() The result is a Number, which is the X coordinate in pixels of the left hand side of the GUI Vim window. The result will be @@ -5575,6 +5584,9 @@ getwinvar({winnr}, {varname} [, {def}]) *getwinvar()* Examples: > :let list_is_on = getwinvar(2, '&list') :echo "myvar = " . getwinvar(1, 'myvar') + +< Can also be used as a |method|: > + GetWinnr()->getwinvar(varname) < glob({expr} [, {nosuf} [, {list} [, {alllinks}]]]) *glob()* Expand the file wildcards in {expr}. See |wildcards| for the @@ -5612,6 +5624,9 @@ glob({expr} [, {nosuf} [, {list} [, {alllinks}]]]) *glob()* See |expand()| for expanding special Vim variables. See |system()| for getting the raw output of an external command. + Can also be used as a |method|: > + GetExpr()->glob() + glob2regpat({string}) *glob2regpat()* Convert a file pattern, as used by glob(), into a search pattern. The result can be used to match with a string that @@ -5624,7 +5639,9 @@ glob2regpat({string}) *glob2regpat()* Note that the result depends on the system. On MS-Windows a backslash usually means a path separator. - *globpath()* + Can also be used as a |method|: > + GetExpr()->glob2regpat() +< *globpath()* globpath({path}, {expr} [, {nosuf} [, {list} [, {allinks}]]]) Perform glob() for String {expr} on all directories in {path} and concatenate the results. Example: > @@ -5660,6 +5677,10 @@ globpath({path}, {expr} [, {nosuf} [, {list} [, {allinks}]]]) < Upwards search and limiting the depth of "**" is not supported, thus using 'path' will not always work properly. + Can also be used as a |method|, the base is passed as the + second argument: > + GetExpr()->globpath(&rtp) +< *has()* has({feature}) Returns 1 if {feature} is supported, 0 otherwise. The {feature} argument is a feature name like "nvim-0.2.1" or diff --git a/src/nvim/eval.lua b/src/nvim/eval.lua index 83a72cc233..cc38a0734e 100644 --- a/src/nvim/eval.lua +++ b/src/nvim/eval.lua @@ -172,15 +172,15 @@ return { gettabinfo={args={0, 1}, base=1}, gettabvar={args={2, 3}, base=1}, gettabwinvar={args={3, 4}, base=1}, - gettagstack={args={0, 1}}, - getwininfo={args={0, 1}}, - getwinpos={args={0, 1}}, + gettagstack={args={0, 1}, base=1}, + getwininfo={args={0, 1}, base=1}, + getwinpos={args={0, 1}, base=1}, getwinposx={}, getwinposy={}, - getwinvar={args={2, 3}}, - glob={args={1, 4}}, - glob2regpat={args=1}, - globpath={args={2, 5}}, + getwinvar={args={2, 3}, base=1}, + glob={args={1, 4}, base=1}, + glob2regpat={args=1, base=1}, + globpath={args={2, 5}, base=2}, has={args=1}, has_key={args=2, base=1}, haslocaldir={args={0,2}}, diff --git a/src/nvim/testdir/test_bufwintabinfo.vim b/src/nvim/testdir/test_bufwintabinfo.vim index b0258547b8..bb672cf0ec 100644 --- a/src/nvim/testdir/test_bufwintabinfo.vim +++ b/src/nvim/testdir/test_bufwintabinfo.vim @@ -77,7 +77,7 @@ function Test_getbufwintabinfo() call assert_equal('green', winlist[2].variables.signal) call assert_equal(w4_id, winlist[3].winid) - let winfo = getwininfo(w5_id)[0] + let winfo = w5_id->getwininfo()[0] call assert_equal(2, winfo.tabnr) call assert_equal([], getwininfo(3)) diff --git a/src/nvim/testdir/test_escaped_glob.vim b/src/nvim/testdir/test_escaped_glob.vim index 2bfd82c296..1a4fd8bdab 100644 --- a/src/nvim/testdir/test_escaped_glob.vim +++ b/src/nvim/testdir/test_escaped_glob.vim @@ -16,7 +16,7 @@ function Test_glob() " Execute these commands in the sandbox, so that using the shell fails. " Setting 'shell' to an invalid name causes a memory leak. sandbox call assert_equal("", glob('Xxx\{')) - sandbox call assert_equal("", glob('Xxx\$')) + sandbox call assert_equal("", 'Xxx\$'->glob()) w! Xxx\{ " } to fix highlighting w! Xxx\$ @@ -28,7 +28,7 @@ endfunction function Test_globpath() sandbox call assert_equal(expand("sautest/autoload/globone.vim\nsautest/autoload/globtwo.vim"), - \ globpath('sautest/autoload', 'glob*.vim')) + \ globpath('sautest/autoload', 'glob*.vim')) sandbox call assert_equal([expand('sautest/autoload/globone.vim'), expand('sautest/autoload/globtwo.vim')], - \ globpath('sautest/autoload', 'glob*.vim', 0, 1)) + \ 'glob*.vim'->globpath('sautest/autoload', 0, 1)) endfunction diff --git a/src/nvim/testdir/test_getvar.vim b/src/nvim/testdir/test_getvar.vim index e9868c7887..5a96548893 100644 --- a/src/nvim/testdir/test_getvar.vim +++ b/src/nvim/testdir/test_getvar.vim @@ -12,8 +12,8 @@ func Test_var() let def_str = "Chance" call assert_equal('Dance', getwinvar(1, 'var_str')) call assert_equal('Dance', getwinvar(1, 'var_str', def_str)) - call assert_equal({'var_str': 'Dance'}, getwinvar(1, '')) - call assert_equal({'var_str': 'Dance'}, getwinvar(1, '', def_str)) + call assert_equal({'var_str': 'Dance'}, 1->getwinvar('')) + call assert_equal({'var_str': 'Dance'}, 1->getwinvar('', def_str)) unlet w:var_str call assert_equal('Chance', getwinvar(1, 'var_str', def_str)) call assert_equal({}, getwinvar(1, '')) diff --git a/src/nvim/testdir/test_glob2regpat.vim b/src/nvim/testdir/test_glob2regpat.vim index 354f239ef1..a423a4a9f0 100644 --- a/src/nvim/testdir/test_glob2regpat.vim +++ b/src/nvim/testdir/test_glob2regpat.vim @@ -10,7 +10,7 @@ endfunc func Test_glob2regpat_valid() call assert_equal('^foo\.', glob2regpat('foo.*')) - call assert_equal('^foo.$', glob2regpat('foo?')) + call assert_equal('^foo.$', 'foo?'->glob2regpat()) call assert_equal('\.vim$', glob2regpat('*.vim')) call assert_equal('^[abc]$', glob2regpat('[abc]')) call assert_equal('^foo bar$', glob2regpat('foo\ bar')) diff --git a/src/nvim/testdir/test_tagjump.vim b/src/nvim/testdir/test_tagjump.vim index 0fa7f85f0d..15182893e9 100644 --- a/src/nvim/testdir/test_tagjump.vim +++ b/src/nvim/testdir/test_tagjump.vim @@ -316,7 +316,7 @@ func Test_getsettagstack() enew | only call settagstack(1, {'items' : []}) call assert_equal(0, gettagstack(1).length) - call assert_equal([], gettagstack(1).items) + call assert_equal([], 1->gettagstack().items) " Error cases call assert_equal({}, gettagstack(100)) call assert_equal(-1, settagstack(100, {'items' : []})) |