forked from aniani/vim
patch 8.1.2013: 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:
@@ -9750,7 +9750,10 @@ timer_info([{id}])
|
||||
"callback" the callback
|
||||
"paused" 1 if the timer is paused, 0 otherwise
|
||||
|
||||
{only available when compiled with the |+timers| feature}
|
||||
Can also be used as a |method|: >
|
||||
GetTimer()->timer_info()
|
||||
|
||||
< {only available when compiled with the |+timers| feature}
|
||||
|
||||
timer_pause({timer}, {paused}) *timer_pause()*
|
||||
Pause or unpause a timer. A paused timer does not invoke its
|
||||
@@ -9765,7 +9768,10 @@ timer_pause({timer}, {paused}) *timer_pause()*
|
||||
String, then the timer is paused, otherwise it is unpaused.
|
||||
See |non-zero-arg|.
|
||||
|
||||
{only available when compiled with the |+timers| feature}
|
||||
Can also be used as a |method|: >
|
||||
GetTimer()->timer_pause(1)
|
||||
|
||||
< {only available when compiled with the |+timers| feature}
|
||||
|
||||
*timer_start()* *timer* *timers*
|
||||
timer_start({time}, {callback} [, {options}])
|
||||
@@ -9798,7 +9804,10 @@ timer_start({time}, {callback} [, {options}])
|
||||
< This will invoke MyHandler() three times at 500 msec
|
||||
intervals.
|
||||
|
||||
Not available in the |sandbox|.
|
||||
Can also be used as a |method|: >
|
||||
GetMsec()->timer_start(callback)
|
||||
|
||||
< Not available in the |sandbox|.
|
||||
{only available when compiled with the |+timers| feature}
|
||||
|
||||
timer_stop({timer}) *timer_stop()*
|
||||
@@ -9806,7 +9815,10 @@ timer_stop({timer}) *timer_stop()*
|
||||
{timer} is an ID returned by timer_start(), thus it must be a
|
||||
Number. If {timer} does not exist there is no error.
|
||||
|
||||
{only available when compiled with the |+timers| feature}
|
||||
Can also be used as a |method|: >
|
||||
GetTimer()->timer_stop()
|
||||
|
||||
< {only available when compiled with the |+timers| feature}
|
||||
|
||||
timer_stopall() *timer_stopall()*
|
||||
Stop all timers. The timer callbacks will no longer be
|
||||
@@ -9820,11 +9832,17 @@ tolower({expr}) *tolower()*
|
||||
characters turned into lowercase (just like applying |gu| to
|
||||
the string).
|
||||
|
||||
Can also be used as a |method|: >
|
||||
GetText()->tolower()
|
||||
|
||||
toupper({expr}) *toupper()*
|
||||
The result is a copy of the String given, with all lowercase
|
||||
characters turned into uppercase (just like applying |gU| to
|
||||
the string).
|
||||
|
||||
Can also be used as a |method|: >
|
||||
GetText()->toupper()
|
||||
|
||||
tr({src}, {fromstr}, {tostr}) *tr()*
|
||||
The result is a copy of the {src} string with all characters
|
||||
which appear in {fromstr} replaced by the character in that
|
||||
@@ -9839,6 +9857,9 @@ tr({src}, {fromstr}, {tostr}) *tr()*
|
||||
echo tr("<blob>", "<>", "{}")
|
||||
< returns "{blob}"
|
||||
|
||||
Can also be used as a |method|: >
|
||||
GetText()->tr(from, to)
|
||||
|
||||
trim({text} [, {mask}]) *trim()*
|
||||
Return {text} as a String where any character in {mask} is
|
||||
removed from the beginning and end of {text}.
|
||||
@@ -9855,6 +9876,9 @@ trim({text} [, {mask}]) *trim()*
|
||||
echo trim("rm<Xrm<>X>rrm", "rm<>")
|
||||
< returns "Xrm<>X" (characters in the middle are not removed)
|
||||
|
||||
Can also be used as a |method|: >
|
||||
GetText()->trim()
|
||||
|
||||
trunc({expr}) *trunc()*
|
||||
Return the largest integral value with magnitude less than or
|
||||
equal to {expr} as a |Float| (truncate towards zero).
|
||||
@@ -9915,6 +9939,9 @@ undofile({name}) *undofile()*
|
||||
When compiled without the |+persistent_undo| option this always
|
||||
returns an empty string.
|
||||
|
||||
Can also be used as a |method|: >
|
||||
GetFilename()->undofile()
|
||||
|
||||
undotree() *undotree()*
|
||||
Return the current state of the undo tree in a dictionary with
|
||||
the following items:
|
||||
@@ -10013,8 +10040,11 @@ virtcol({expr}) *virtcol()*
|
||||
all lines: >
|
||||
echo max(map(range(1, line('$')), "virtcol([v:val, '$'])"))
|
||||
|
||||
< Can also be used as a |method|: >
|
||||
GetPos()->virtcol()
|
||||
|
||||
visualmode([expr]) *visualmode()*
|
||||
|
||||
visualmode([{expr}]) *visualmode()*
|
||||
The result is a String, which describes the last Visual mode
|
||||
used in the current buffer. Initially it returns an empty
|
||||
string, but once Visual mode has been used, it returns "v",
|
||||
@@ -10028,7 +10058,7 @@ visualmode([expr]) *visualmode()*
|
||||
Visual mode that was used.
|
||||
If Visual mode is active, use |mode()| to get the Visual mode
|
||||
(e.g., in a |:vmap|).
|
||||
If [expr] is supplied and it evaluates to a non-zero Number or
|
||||
If {expr} is supplied and it evaluates to a non-zero Number or
|
||||
a non-empty String, then the Visual mode will be cleared and
|
||||
the old value is returned. See |non-zero-arg|.
|
||||
|
||||
@@ -10057,10 +10087,17 @@ win_execute({id}, {command} [, {silent}]) *win_execute()*
|
||||
Not all commands are allowed in popup windows.
|
||||
When window {id} does not exist then no error is given.
|
||||
|
||||
Can also be used as a |method|, the base is used for the
|
||||
command: >
|
||||
GetCommand()->win_execute(winid)
|
||||
|
||||
win_findbuf({bufnr}) *win_findbuf()*
|
||||
Returns a list with |window-ID|s for windows that contain
|
||||
buffer {bufnr}. When there is none the list is empty.
|
||||
|
||||
Can also be used as a |method|: >
|
||||
GetBufnr()->win_findbuf()
|
||||
|
||||
win_getid([{win} [, {tab}]]) *win_getid()*
|
||||
Get the |window-ID| for the specified window.
|
||||
When {win} is missing use the current window.
|
||||
@@ -10070,20 +10107,32 @@ win_getid([{win} [, {tab}]]) *win_getid()*
|
||||
number {tab}. The first tab has number one.
|
||||
Return zero if the window cannot be found.
|
||||
|
||||
Can also be used as a |method|: >
|
||||
GetWinnr()->win_getid()
|
||||
|
||||
win_gotoid({expr}) *win_gotoid()*
|
||||
Go to window with ID {expr}. This may also change the current
|
||||
tabpage.
|
||||
Return 1 if successful, 0 if the window cannot be found.
|
||||
|
||||
Can also be used as a |method|: >
|
||||
GetWinid()->win_gotoid()
|
||||
|
||||
win_id2tabwin({expr}) *win_id2tabwin()*
|
||||
Return a list with the tab number and window number of window
|
||||
with ID {expr}: [tabnr, winnr].
|
||||
Return [0, 0] if the window cannot be found.
|
||||
|
||||
Can also be used as a |method|: >
|
||||
GetWinid()->win_id2tabwin()
|
||||
|
||||
win_id2win({expr}) *win_id2win()*
|
||||
Return the window number of window with ID {expr}.
|
||||
Return 0 if the window cannot be found in the current tabpage.
|
||||
|
||||
Can also be used as a |method|: >
|
||||
GetWinid()->win_id2win()
|
||||
|
||||
win_screenpos({nr}) *win_screenpos()*
|
||||
Return the screen position of window {nr} as a list with two
|
||||
numbers: [row, col]. The first window always has position
|
||||
@@ -10092,6 +10141,9 @@ win_screenpos({nr}) *win_screenpos()*
|
||||
Return [0, 0] if the window cannot be found in the current
|
||||
tabpage.
|
||||
|
||||
Can also be used as a |method|: >
|
||||
GetWinid()->win_screenpos()
|
||||
<
|
||||
*winbufnr()*
|
||||
winbufnr({nr}) The result is a Number, which is the number of the buffer
|
||||
associated with window {nr}. {nr} can be the window number or
|
||||
@@ -10119,6 +10171,9 @@ winheight({nr}) *winheight()*
|
||||
This excludes any window toolbar line.
|
||||
Examples: >
|
||||
:echo "The current window has " . winheight(0) . " lines."
|
||||
|
||||
< Can also be used as a |method|: >
|
||||
GetWinid()->winheight()
|
||||
<
|
||||
winlayout([{tabnr}]) *winlayout()*
|
||||
The result is a nested List containing the layout of windows
|
||||
@@ -10148,6 +10203,9 @@ winlayout([{tabnr}]) *winlayout()*
|
||||
:echo winlayout(2)
|
||||
['col', [['leaf', 1002], ['row', ['leaf', 1003],
|
||||
['leaf', 1001]]], ['leaf', 1000]]
|
||||
<
|
||||
Can also be used as a |method|: >
|
||||
GetTabnr()->winlayout()
|
||||
<
|
||||
*winline()*
|
||||
winline() The result is a Number, which is the screen line of the cursor
|
||||
@@ -10182,6 +10240,9 @@ winnr([{arg}]) The result is a Number, which is the number of the current
|
||||
let window_count = winnr('$')
|
||||
let prev_window = winnr('#')
|
||||
let wnum = winnr('3k')
|
||||
|
||||
< Can also be used as a |method|: >
|
||||
GetWinval()->winnr()
|
||||
<
|
||||
*winrestcmd()*
|
||||
winrestcmd() Returns a sequence of |:resize| commands that should restore
|
||||
@@ -10210,6 +10271,9 @@ winrestview({dict})
|
||||
If you have changed the values the result is unpredictable.
|
||||
If the window size changed the result won't be the same.
|
||||
|
||||
Can also be used as a |method|: >
|
||||
GetView()->winrestview()
|
||||
<
|
||||
*winsaveview()*
|
||||
winsaveview() Returns a |Dictionary| that contains information to restore
|
||||
the view of the current window. Use |winrestview()| to
|
||||
@@ -10247,6 +10311,9 @@ winwidth({nr}) *winwidth()*
|
||||
< For getting the terminal or screen size, see the 'columns'
|
||||
option.
|
||||
|
||||
Can also be used as a |method|: >
|
||||
GetWinid()->winwidth()
|
||||
|
||||
|
||||
wordcount() *wordcount()*
|
||||
The result is a dictionary of byte/chars/word statistics for
|
||||
@@ -10308,6 +10375,9 @@ writefile({object}, {fname} [, {flags}])
|
||||
:let fl = readfile("foo", "b")
|
||||
:call writefile(fl, "foocopy", "b")
|
||||
|
||||
< Can also be used as a |method|: >
|
||||
GetText()->writefile("thefile")
|
||||
|
||||
|
||||
xor({expr}, {expr}) *xor()*
|
||||
Bitwise XOR on the two arguments. The arguments are converted
|
||||
|
||||
Reference in New Issue
Block a user