mirror of
https://github.com/vim/vim.git
synced 2025-10-04 05:25:06 -04:00
patch 8.1.1987: more functions can be used as methods
Problem: More functions can be used as methods. Solution: Make various functions usable as a method.
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
*eval.txt* For Vim version 8.1. Last change: 2019 Aug 31
|
*eval.txt* For Vim version 8.1. Last change: 2019 Sep 04
|
||||||
|
|
||||||
|
|
||||||
VIM REFERENCE MANUAL by Bram Moolenaar
|
VIM REFERENCE MANUAL by Bram Moolenaar
|
||||||
@@ -2547,7 +2547,7 @@ keys({dict}) List keys in {dict}
|
|||||||
len({expr}) Number the length of {expr}
|
len({expr}) Number the length of {expr}
|
||||||
libcall({lib}, {func}, {arg}) String call {func} in library {lib} with {arg}
|
libcall({lib}, {func}, {arg}) String call {func} in library {lib} with {arg}
|
||||||
libcallnr({lib}, {func}, {arg}) Number idem, but return a Number
|
libcallnr({lib}, {func}, {arg}) Number idem, but return a Number
|
||||||
line({expr}) Number line nr of cursor, last line or mark
|
line({expr} [, {winid}]) Number line nr of cursor, last line or mark
|
||||||
line2byte({lnum}) Number byte count of line {lnum}
|
line2byte({lnum}) Number byte count of line {lnum}
|
||||||
lispindent({lnum}) Number Lisp indent for line {lnum}
|
lispindent({lnum}) Number Lisp indent for line {lnum}
|
||||||
list2str({list} [, {utf8}]) String turn numbers in {list} into a String
|
list2str({list} [, {utf8}]) String turn numbers in {list} into a String
|
||||||
@@ -5688,8 +5688,8 @@ glob2regpat({expr}) *glob2regpat()*
|
|||||||
GetExpr()->glob2regpat()
|
GetExpr()->glob2regpat()
|
||||||
< *globpath()*
|
< *globpath()*
|
||||||
globpath({path}, {expr} [, {nosuf} [, {list} [, {alllinks}]]])
|
globpath({path}, {expr} [, {nosuf} [, {list} [, {alllinks}]]])
|
||||||
Perform glob() on all directories in {path} and concatenate
|
Perform glob() for {expr} on all directories in {path} and
|
||||||
the results. Example: >
|
concatenate the results. Example: >
|
||||||
:echo globpath(&rtp, "syntax/c.vim")
|
:echo globpath(&rtp, "syntax/c.vim")
|
||||||
<
|
<
|
||||||
{path} is a comma-separated list of directory names. Each
|
{path} is a comma-separated list of directory names. Each
|
||||||
@@ -5790,7 +5790,9 @@ hasmapto({what} [, {mode} [, {abbr}]]) *hasmapto()*
|
|||||||
If no matching mapping is found 0 is returned.
|
If no matching mapping is found 0 is returned.
|
||||||
The following characters are recognized in {mode}:
|
The following characters are recognized in {mode}:
|
||||||
n Normal mode
|
n Normal mode
|
||||||
v Visual mode
|
v Visual and Select mode
|
||||||
|
x Visual mode
|
||||||
|
s Select mode
|
||||||
o Operator-pending mode
|
o Operator-pending mode
|
||||||
i Insert mode
|
i Insert mode
|
||||||
l Language-Argument ("r", "f", "t", etc.)
|
l Language-Argument ("r", "f", "t", etc.)
|
||||||
@@ -6376,8 +6378,9 @@ libcallnr({libname}, {funcname}, {argument})
|
|||||||
the argument to the called function: >
|
the argument to the called function: >
|
||||||
GetValue()->libcallnr("libc.so", "printf")
|
GetValue()->libcallnr("libc.so", "printf")
|
||||||
<
|
<
|
||||||
*line()*
|
|
||||||
line({expr}) The result is a Number, which is the line number of the file
|
line({expr} [, {winid}]) *line()*
|
||||||
|
The result is a Number, which is the line number of the file
|
||||||
position given with {expr}. The accepted positions are:
|
position given with {expr}. The accepted positions are:
|
||||||
. the cursor position
|
. the cursor position
|
||||||
$ the last line in the current buffer
|
$ the last line in the current buffer
|
||||||
@@ -6395,8 +6398,11 @@ line({expr}) The result is a Number, which is the line number of the file
|
|||||||
then applies to another buffer.
|
then applies to another buffer.
|
||||||
To get the column number use |col()|. To get both use
|
To get the column number use |col()|. To get both use
|
||||||
|getpos()|.
|
|getpos()|.
|
||||||
|
With the optional {winid} argument the values are obtained for
|
||||||
|
that window instead of the current window.
|
||||||
Examples: >
|
Examples: >
|
||||||
line(".") line number of the cursor
|
line(".") line number of the cursor
|
||||||
|
line(".", winid) idem, in window "winid"
|
||||||
line("'t") line number of mark t
|
line("'t") line number of mark t
|
||||||
line("'" . marker) line number of mark marker
|
line("'" . marker) line number of mark marker
|
||||||
<
|
<
|
||||||
@@ -7546,6 +7552,9 @@ range({expr} [, {max} [, {stride}]]) *range()*
|
|||||||
range(2, -2, -1) " [2, 1, 0, -1, -2]
|
range(2, -2, -1) " [2, 1, 0, -1, -2]
|
||||||
range(0) " []
|
range(0) " []
|
||||||
range(2, 0) " error!
|
range(2, 0) " error!
|
||||||
|
<
|
||||||
|
Can also be used as a |method|: >
|
||||||
|
GetExpr()->range()
|
||||||
<
|
<
|
||||||
*readdir()*
|
*readdir()*
|
||||||
readdir({directory} [, {expr}])
|
readdir({directory} [, {expr}])
|
||||||
@@ -7575,6 +7584,9 @@ readdir({directory} [, {expr}])
|
|||||||
\ {x : s:tree(a:dir . '/' . x)} : x})}
|
\ {x : s:tree(a:dir . '/' . x)} : x})}
|
||||||
endfunction
|
endfunction
|
||||||
echo s:tree(".")
|
echo s:tree(".")
|
||||||
|
<
|
||||||
|
Can also be used as a |method|: >
|
||||||
|
GetDirName()->readdir()
|
||||||
<
|
<
|
||||||
*readfile()*
|
*readfile()*
|
||||||
readfile({fname} [, {type} [, {max}]])
|
readfile({fname} [, {type} [, {max}]])
|
||||||
@@ -7610,6 +7622,9 @@ readfile({fname} [, {type} [, {max}]])
|
|||||||
the result is an empty list.
|
the result is an empty list.
|
||||||
Also see |writefile()|.
|
Also see |writefile()|.
|
||||||
|
|
||||||
|
Can also be used as a |method|: >
|
||||||
|
GetFileName()->readfile()
|
||||||
|
|
||||||
reg_executing() *reg_executing()*
|
reg_executing() *reg_executing()*
|
||||||
Returns the single letter name of the register being executed.
|
Returns the single letter name of the register being executed.
|
||||||
Returns an empty string when no register is being executed.
|
Returns an empty string when no register is being executed.
|
||||||
@@ -7631,6 +7646,10 @@ reltime([{start} [, {end}]]) *reltime()*
|
|||||||
and {end}.
|
and {end}.
|
||||||
The {start} and {end} arguments must be values returned by
|
The {start} and {end} arguments must be values returned by
|
||||||
reltime().
|
reltime().
|
||||||
|
|
||||||
|
Can also be used as a |method|: >
|
||||||
|
GetStart()->reltime()
|
||||||
|
<
|
||||||
{only available when compiled with the |+reltime| feature}
|
{only available when compiled with the |+reltime| feature}
|
||||||
|
|
||||||
reltimefloat({time}) *reltimefloat()*
|
reltimefloat({time}) *reltimefloat()*
|
||||||
@@ -7641,7 +7660,11 @@ reltimefloat({time}) *reltimefloat()*
|
|||||||
let seconds = reltimefloat(reltime(start))
|
let seconds = reltimefloat(reltime(start))
|
||||||
< See the note of reltimestr() about overhead.
|
< See the note of reltimestr() about overhead.
|
||||||
Also see |profiling|.
|
Also see |profiling|.
|
||||||
{only available when compiled with the |+reltime| feature}
|
|
||||||
|
Can also be used as a |method|: >
|
||||||
|
reltime(start)->reltimefloat()
|
||||||
|
|
||||||
|
< {only available when compiled with the |+reltime| feature}
|
||||||
|
|
||||||
reltimestr({time}) *reltimestr()*
|
reltimestr({time}) *reltimestr()*
|
||||||
Return a String that represents the time value of {time}.
|
Return a String that represents the time value of {time}.
|
||||||
@@ -7656,7 +7679,11 @@ reltimestr({time}) *reltimestr()*
|
|||||||
can use split() to remove it. >
|
can use split() to remove it. >
|
||||||
echo split(reltimestr(reltime(start)))[0]
|
echo split(reltimestr(reltime(start)))[0]
|
||||||
< Also see |profiling|.
|
< Also see |profiling|.
|
||||||
{only available when compiled with the |+reltime| feature}
|
|
||||||
|
Can also be used as a |method|: >
|
||||||
|
reltime(start)->reltimestr()
|
||||||
|
|
||||||
|
< {only available when compiled with the |+reltime| feature}
|
||||||
|
|
||||||
*remote_expr()* *E449*
|
*remote_expr()* *E449*
|
||||||
remote_expr({server}, {string} [, {idvar} [, {timeout}]])
|
remote_expr({server}, {string} [, {idvar} [, {timeout}]])
|
||||||
@@ -7685,6 +7712,8 @@ remote_expr({server}, {string} [, {idvar} [, {timeout}]])
|
|||||||
:echo remote_expr("gvim", "2+2")
|
:echo remote_expr("gvim", "2+2")
|
||||||
:echo remote_expr("gvim1", "b:current_syntax")
|
:echo remote_expr("gvim1", "b:current_syntax")
|
||||||
<
|
<
|
||||||
|
Can also be used as a |method|: >
|
||||||
|
ServerName()->remote_expr(expr)
|
||||||
|
|
||||||
remote_foreground({server}) *remote_foreground()*
|
remote_foreground({server}) *remote_foreground()*
|
||||||
Move the Vim server with the name {server} to the foreground.
|
Move the Vim server with the name {server} to the foreground.
|
||||||
@@ -7696,7 +7725,11 @@ remote_foreground({server}) *remote_foreground()*
|
|||||||
Note: This does not restore the window if it was minimized,
|
Note: This does not restore the window if it was minimized,
|
||||||
like foreground() does.
|
like foreground() does.
|
||||||
This function is not available in the |sandbox|.
|
This function is not available in the |sandbox|.
|
||||||
{only in the Win32, Athena, Motif and GTK GUI versions and the
|
|
||||||
|
Can also be used as a |method|: >
|
||||||
|
ServerName()->remote_foreground()
|
||||||
|
|
||||||
|
< {only in the Win32, Athena, Motif and GTK GUI versions and the
|
||||||
Win32 console version}
|
Win32 console version}
|
||||||
|
|
||||||
|
|
||||||
@@ -7714,6 +7747,9 @@ remote_peek({serverid} [, {retvar}]) *remote_peek()*
|
|||||||
:let repl = ""
|
:let repl = ""
|
||||||
:echo "PEEK: ".remote_peek(id, "repl").": ".repl
|
:echo "PEEK: ".remote_peek(id, "repl").": ".repl
|
||||||
|
|
||||||
|
< Can also be used as a |method|: >
|
||||||
|
ServerId()->remote_peek()
|
||||||
|
|
||||||
remote_read({serverid}, [{timeout}]) *remote_read()*
|
remote_read({serverid}, [{timeout}]) *remote_read()*
|
||||||
Return the oldest available reply from {serverid} and consume
|
Return the oldest available reply from {serverid} and consume
|
||||||
it. Unless a {timeout} in seconds is given, it blocks until a
|
it. Unless a {timeout} in seconds is given, it blocks until a
|
||||||
@@ -7723,6 +7759,9 @@ remote_read({serverid}, [{timeout}]) *remote_read()*
|
|||||||
{only available when compiled with the |+clientserver| feature}
|
{only available when compiled with the |+clientserver| feature}
|
||||||
Example: >
|
Example: >
|
||||||
:echo remote_read(id)
|
:echo remote_read(id)
|
||||||
|
|
||||||
|
< Can also be used as a |method|: >
|
||||||
|
ServerId()->remote_read()
|
||||||
<
|
<
|
||||||
*remote_send()* *E241*
|
*remote_send()* *E241*
|
||||||
remote_send({server}, {string} [, {idvar}])
|
remote_send({server}, {string} [, {idvar}])
|
||||||
@@ -7746,12 +7785,19 @@ remote_send({server}, {string} [, {idvar}])
|
|||||||
\ echo remote_read(expand("<amatch>"))
|
\ echo remote_read(expand("<amatch>"))
|
||||||
:echo remote_send("gvim", ":sleep 10 | echo ".
|
:echo remote_send("gvim", ":sleep 10 | echo ".
|
||||||
\ 'server2client(expand("<client>"), "HELLO")<CR>')
|
\ 'server2client(expand("<client>"), "HELLO")<CR>')
|
||||||
|
<
|
||||||
|
Can also be used as a |method|: >
|
||||||
|
ServerName()->remote_send(keys)
|
||||||
<
|
<
|
||||||
*remote_startserver()* *E941* *E942*
|
*remote_startserver()* *E941* *E942*
|
||||||
remote_startserver({name})
|
remote_startserver({name})
|
||||||
Become the server {name}. This fails if already running as a
|
Become the server {name}. This fails if already running as a
|
||||||
server, when |v:servername| is not empty.
|
server, when |v:servername| is not empty.
|
||||||
{only available when compiled with the |+clientserver| feature}
|
|
||||||
|
Can also be used as a |method|: >
|
||||||
|
ServerName()->remote_startserver()
|
||||||
|
|
||||||
|
< {only available when compiled with the |+clientserver| feature}
|
||||||
|
|
||||||
remove({list}, {idx} [, {end}]) *remove()*
|
remove({list}, {idx} [, {end}]) *remove()*
|
||||||
Without {end}: Remove the item at {idx} from |List| {list} and
|
Without {end}: Remove the item at {idx} from |List| {list} and
|
||||||
@@ -7795,6 +7841,9 @@ rename({from}, {to}) *rename()*
|
|||||||
NOTE: If {to} exists it is overwritten without warning.
|
NOTE: If {to} exists it is overwritten without warning.
|
||||||
This function is not available in the |sandbox|.
|
This function is not available in the |sandbox|.
|
||||||
|
|
||||||
|
Can also be used as a |method|: >
|
||||||
|
GetOldName()->rename(newname)
|
||||||
|
|
||||||
repeat({expr}, {count}) *repeat()*
|
repeat({expr}, {count}) *repeat()*
|
||||||
Repeat {expr} {count} times and return the concatenated
|
Repeat {expr} {count} times and return the concatenated
|
||||||
result. Example: >
|
result. Example: >
|
||||||
@@ -7824,6 +7873,8 @@ resolve({filename}) *resolve()* *E655*
|
|||||||
current directory (provided the result is still a relative
|
current directory (provided the result is still a relative
|
||||||
path name) and also keeps a trailing path separator.
|
path name) and also keeps a trailing path separator.
|
||||||
|
|
||||||
|
Can also be used as a |method|: >
|
||||||
|
GetName()->resolve()
|
||||||
|
|
||||||
reverse({object}) *reverse()*
|
reverse({object}) *reverse()*
|
||||||
Reverse the order of items in {object} in-place.
|
Reverse the order of items in {object} in-place.
|
||||||
@@ -7861,7 +7912,11 @@ rubyeval({expr}) *rubyeval()*
|
|||||||
Hashes are represented as Vim |Dictionary| type.
|
Hashes are represented as Vim |Dictionary| type.
|
||||||
Other objects are represented as strings resulted from their
|
Other objects are represented as strings resulted from their
|
||||||
"Object#to_s" method.
|
"Object#to_s" method.
|
||||||
{only available when compiled with the |+ruby| feature}
|
|
||||||
|
Can also be used as a |method|: >
|
||||||
|
GetRubyExpr()->rubyeval()
|
||||||
|
|
||||||
|
< {only available when compiled with the |+ruby| feature}
|
||||||
|
|
||||||
screenattr({row}, {col}) *screenattr()*
|
screenattr({row}, {col}) *screenattr()*
|
||||||
Like |screenchar()|, but return the attribute. This is a rather
|
Like |screenchar()|, but return the attribute. This is a rather
|
||||||
@@ -10231,6 +10286,7 @@ macunix Synonym for osxdarwin
|
|||||||
menu Compiled with support for |:menu|.
|
menu Compiled with support for |:menu|.
|
||||||
mksession Compiled with support for |:mksession|.
|
mksession Compiled with support for |:mksession|.
|
||||||
modify_fname Compiled with file name modifiers. |filename-modifiers|
|
modify_fname Compiled with file name modifiers. |filename-modifiers|
|
||||||
|
(always true)
|
||||||
mouse Compiled with support mouse.
|
mouse Compiled with support mouse.
|
||||||
mouse_dec Compiled with support for Dec terminal mouse.
|
mouse_dec Compiled with support for Dec terminal mouse.
|
||||||
mouse_gpm Compiled with support for gpm (Linux console mouse)
|
mouse_gpm Compiled with support for gpm (Linux console mouse)
|
||||||
|
@@ -684,32 +684,32 @@ static funcentry_T global_functions[] =
|
|||||||
#if defined(FEAT_PYTHON) || defined(FEAT_PYTHON3)
|
#if defined(FEAT_PYTHON) || defined(FEAT_PYTHON3)
|
||||||
{"pyxeval", 1, 1, FEARG_1, f_pyxeval},
|
{"pyxeval", 1, 1, FEARG_1, f_pyxeval},
|
||||||
#endif
|
#endif
|
||||||
{"range", 1, 3, 0, f_range},
|
{"range", 1, 3, FEARG_1, f_range},
|
||||||
{"readdir", 1, 2, 0, f_readdir},
|
{"readdir", 1, 2, FEARG_1, f_readdir},
|
||||||
{"readfile", 1, 3, 0, f_readfile},
|
{"readfile", 1, 3, FEARG_1, f_readfile},
|
||||||
{"reg_executing", 0, 0, 0, f_reg_executing},
|
{"reg_executing", 0, 0, 0, f_reg_executing},
|
||||||
{"reg_recording", 0, 0, 0, f_reg_recording},
|
{"reg_recording", 0, 0, 0, f_reg_recording},
|
||||||
{"reltime", 0, 2, 0, f_reltime},
|
{"reltime", 0, 2, FEARG_1, f_reltime},
|
||||||
#ifdef FEAT_FLOAT
|
#ifdef FEAT_FLOAT
|
||||||
{"reltimefloat", 1, 1, 0, f_reltimefloat},
|
{"reltimefloat", 1, 1, FEARG_1, f_reltimefloat},
|
||||||
#endif
|
#endif
|
||||||
{"reltimestr", 1, 1, 0, f_reltimestr},
|
{"reltimestr", 1, 1, FEARG_1, f_reltimestr},
|
||||||
{"remote_expr", 2, 4, 0, f_remote_expr},
|
{"remote_expr", 2, 4, FEARG_1, f_remote_expr},
|
||||||
{"remote_foreground", 1, 1, 0, f_remote_foreground},
|
{"remote_foreground", 1, 1, FEARG_1, f_remote_foreground},
|
||||||
{"remote_peek", 1, 2, 0, f_remote_peek},
|
{"remote_peek", 1, 2, FEARG_1, f_remote_peek},
|
||||||
{"remote_read", 1, 2, 0, f_remote_read},
|
{"remote_read", 1, 2, FEARG_1, f_remote_read},
|
||||||
{"remote_send", 2, 3, 0, f_remote_send},
|
{"remote_send", 2, 3, FEARG_1, f_remote_send},
|
||||||
{"remote_startserver", 1, 1, 0, f_remote_startserver},
|
{"remote_startserver", 1, 1, FEARG_1, f_remote_startserver},
|
||||||
{"remove", 2, 3, FEARG_1, f_remove},
|
{"remove", 2, 3, FEARG_1, f_remove},
|
||||||
{"rename", 2, 2, 0, f_rename},
|
{"rename", 2, 2, FEARG_1, f_rename},
|
||||||
{"repeat", 2, 2, FEARG_1, f_repeat},
|
{"repeat", 2, 2, FEARG_1, f_repeat},
|
||||||
{"resolve", 1, 1, 0, f_resolve},
|
{"resolve", 1, 1, FEARG_1, f_resolve},
|
||||||
{"reverse", 1, 1, FEARG_1, f_reverse},
|
{"reverse", 1, 1, FEARG_1, f_reverse},
|
||||||
#ifdef FEAT_FLOAT
|
#ifdef FEAT_FLOAT
|
||||||
{"round", 1, 1, FEARG_1, f_round},
|
{"round", 1, 1, FEARG_1, f_round},
|
||||||
#endif
|
#endif
|
||||||
#ifdef FEAT_RUBY
|
#ifdef FEAT_RUBY
|
||||||
{"rubyeval", 1, 1, 0, f_rubyeval},
|
{"rubyeval", 1, 1, FEARG_1, f_rubyeval},
|
||||||
#endif
|
#endif
|
||||||
{"screenattr", 2, 2, 0, f_screenattr},
|
{"screenattr", 2, 2, 0, f_screenattr},
|
||||||
{"screenchar", 2, 2, 0, f_screenchar},
|
{"screenchar", 2, 2, 0, f_screenchar},
|
||||||
|
@@ -34,7 +34,7 @@ func Test_client_server()
|
|||||||
" When using valgrind it takes much longer.
|
" When using valgrind it takes much longer.
|
||||||
call WaitForAssert({-> assert_match(name, serverlist())})
|
call WaitForAssert({-> assert_match(name, serverlist())})
|
||||||
|
|
||||||
call remote_foreground(name)
|
eval name->remote_foreground()
|
||||||
|
|
||||||
call remote_send(name, ":let testvar = 'yes'\<CR>")
|
call remote_send(name, ":let testvar = 'yes'\<CR>")
|
||||||
call WaitFor('remote_expr("' . name . '", "exists(\"testvar\") ? testvar : \"\"", "", 1) == "yes"')
|
call WaitFor('remote_expr("' . name . '", "exists(\"testvar\") ? testvar : \"\"", "", 1) == "yes"')
|
||||||
@@ -53,7 +53,7 @@ func Test_client_server()
|
|||||||
endif
|
endif
|
||||||
" Wait for the server to be up and answering requests.
|
" Wait for the server to be up and answering requests.
|
||||||
sleep 100m
|
sleep 100m
|
||||||
call WaitForAssert({-> assert_true(remote_expr(name, "v:version", "", 1) != "")})
|
call WaitForAssert({-> assert_true(name->remote_expr("v:version", "", 1) != "")})
|
||||||
|
|
||||||
call remote_send(name, ":let testvar = 'maybe'\<CR>")
|
call remote_send(name, ":let testvar = 'maybe'\<CR>")
|
||||||
call WaitForAssert({-> assert_equal('maybe', remote_expr(name, "testvar", "", 2))})
|
call WaitForAssert({-> assert_equal('maybe', remote_expr(name, "testvar", "", 2))})
|
||||||
@@ -63,7 +63,7 @@ func Test_client_server()
|
|||||||
|
|
||||||
" Expression evaluated locally.
|
" Expression evaluated locally.
|
||||||
if v:servername == ''
|
if v:servername == ''
|
||||||
call remote_startserver('MYSELF')
|
eval 'MYSELF'->remote_startserver()
|
||||||
" May get MYSELF1 when running the test again.
|
" May get MYSELF1 when running the test again.
|
||||||
call assert_match('MYSELF', v:servername)
|
call assert_match('MYSELF', v:servername)
|
||||||
endif
|
endif
|
||||||
@@ -71,11 +71,11 @@ func Test_client_server()
|
|||||||
call assert_equal('myself', remote_expr(v:servername, 'testvar'))
|
call assert_equal('myself', remote_expr(v:servername, 'testvar'))
|
||||||
|
|
||||||
call remote_send(name, ":call server2client(expand('<client>'), 'got it')\<CR>", 'g:myserverid')
|
call remote_send(name, ":call server2client(expand('<client>'), 'got it')\<CR>", 'g:myserverid')
|
||||||
call assert_equal('got it', remote_read(g:myserverid, 2))
|
call assert_equal('got it', g:myserverid->remote_read(2))
|
||||||
|
|
||||||
call remote_send(name, ":call server2client(expand('<client>'), 'another')\<CR>", 'g:myserverid')
|
call remote_send(name, ":call server2client(expand('<client>'), 'another')\<CR>", 'g:myserverid')
|
||||||
let peek_result = 'nothing'
|
let peek_result = 'nothing'
|
||||||
let r = remote_peek(g:myserverid, 'peek_result')
|
let r = g:myserverid->remote_peek('peek_result')
|
||||||
" unpredictable whether the result is already available.
|
" unpredictable whether the result is already available.
|
||||||
if r > 0
|
if r > 0
|
||||||
call assert_equal('another', peek_result)
|
call assert_equal('another', peek_result)
|
||||||
@@ -89,7 +89,7 @@ func Test_client_server()
|
|||||||
call assert_equal('another', g:peek_result)
|
call assert_equal('another', g:peek_result)
|
||||||
call assert_equal('another', remote_read(g:myserverid, 2))
|
call assert_equal('another', remote_read(g:myserverid, 2))
|
||||||
|
|
||||||
call remote_send(name, ":qa!\<CR>")
|
eval name->remote_send(":qa!\<CR>")
|
||||||
try
|
try
|
||||||
call WaitForAssert({-> assert_equal("dead", job_status(job))})
|
call WaitForAssert({-> assert_equal("dead", job_status(job))})
|
||||||
finally
|
finally
|
||||||
|
@@ -75,7 +75,7 @@ func Test_readfile_binary()
|
|||||||
call setline(1, ['one', 'two', 'three'])
|
call setline(1, ['one', 'two', 'three'])
|
||||||
setlocal ff=dos
|
setlocal ff=dos
|
||||||
write XReadfile
|
write XReadfile
|
||||||
let lines = readfile('XReadfile')
|
let lines = 'XReadfile'->readfile()
|
||||||
call assert_equal(['one', 'two', 'three'], lines)
|
call assert_equal(['one', 'two', 'three'], lines)
|
||||||
let lines = readfile('XReadfile', '', 2)
|
let lines = readfile('XReadfile', '', 2)
|
||||||
call assert_equal(['one', 'two'], lines)
|
call assert_equal(['one', 'two'], lines)
|
||||||
|
@@ -253,7 +253,7 @@ func Test_resolve_unix()
|
|||||||
call delete('Xlink')
|
call delete('Xlink')
|
||||||
|
|
||||||
silent !ln -s -f Xlink2/ Xlink1
|
silent !ln -s -f Xlink2/ Xlink1
|
||||||
call assert_equal('Xlink2', resolve('Xlink1'))
|
call assert_equal('Xlink2', 'Xlink1'->resolve())
|
||||||
call assert_equal('Xlink2/', resolve('Xlink1/'))
|
call assert_equal('Xlink2/', resolve('Xlink1/'))
|
||||||
call delete('Xlink1')
|
call delete('Xlink1')
|
||||||
|
|
||||||
@@ -1413,7 +1413,7 @@ func Test_func_range_with_edit()
|
|||||||
" is invalid in that buffer.
|
" is invalid in that buffer.
|
||||||
call writefile(['just one line'], 'Xfuncrange2')
|
call writefile(['just one line'], 'Xfuncrange2')
|
||||||
new
|
new
|
||||||
call setline(1, range(10))
|
call setline(1, 10->range())
|
||||||
write Xfuncrange1
|
write Xfuncrange1
|
||||||
call assert_fails('5,8call EditAnotherFile()', 'E16:')
|
call assert_fails('5,8call EditAnotherFile()', 'E16:')
|
||||||
|
|
||||||
@@ -1544,7 +1544,7 @@ func Test_readdir()
|
|||||||
call assert_equal(['bar.txt', 'dir', 'foo.txt'], sort(files))
|
call assert_equal(['bar.txt', 'dir', 'foo.txt'], sort(files))
|
||||||
|
|
||||||
" Only results containing "f"
|
" Only results containing "f"
|
||||||
let files = readdir('Xdir', { x -> stridx(x, 'f') !=- 1 })
|
let files = 'Xdir'->readdir({ x -> stridx(x, 'f') !=- 1 })
|
||||||
call assert_equal(['foo.txt'], sort(files))
|
call assert_equal(['foo.txt'], sort(files))
|
||||||
|
|
||||||
" Only .txt files
|
" Only .txt files
|
||||||
|
@@ -8,11 +8,11 @@ func Test_reltime()
|
|||||||
let now = reltime()
|
let now = reltime()
|
||||||
sleep 10m
|
sleep 10m
|
||||||
let later = reltime()
|
let later = reltime()
|
||||||
let elapsed = reltime(now)
|
let elapsed = now->reltime()
|
||||||
call assert_true(reltimestr(elapsed) =~ '0\.0')
|
call assert_true(reltimestr(elapsed) =~ '0\.0')
|
||||||
call assert_true(reltimestr(elapsed) != '0.0')
|
call assert_true(elapsed->reltimestr() != '0.0')
|
||||||
call assert_true(reltimefloat(elapsed) < 0.1)
|
call assert_true(reltimefloat(elapsed) < 0.1)
|
||||||
call assert_true(reltimefloat(elapsed) > 0.0)
|
call assert_true(elapsed->reltimefloat() > 0.0)
|
||||||
|
|
||||||
let same = reltime(now, now)
|
let same = reltime(now, now)
|
||||||
call assert_equal('0.000', split(reltimestr(same))[0][:4])
|
call assert_equal('0.000', split(reltimestr(same))[0][:4])
|
||||||
|
@@ -25,7 +25,7 @@ func Test_rename_file_ignore_case()
|
|||||||
set fileignorecase
|
set fileignorecase
|
||||||
call writefile(['foo'], 'Xrename')
|
call writefile(['foo'], 'Xrename')
|
||||||
|
|
||||||
call assert_equal(0, rename('Xrename', 'XRENAME'))
|
call assert_equal(0, 'Xrename'->rename('XRENAME'))
|
||||||
|
|
||||||
call assert_equal(['foo'], readfile('XRENAME'))
|
call assert_equal(['foo'], readfile('XRENAME'))
|
||||||
|
|
||||||
|
@@ -757,6 +757,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
1987,
|
||||||
/**/
|
/**/
|
||||||
1986,
|
1986,
|
||||||
/**/
|
/**/
|
||||||
|
Reference in New Issue
Block a user