mirror of
https://github.com/neovim/neovim.git
synced 2026-07-18 23:21:35 +00:00
feat(eval/method): partially port v8.1.1996
Problem: More functions can be used as methods. Solution: Make various functions usable as a method.aad222c9c9Partial port as this does not include eval.txt change for listener_add. Cherry-pick eval.txt changes for: - bufadd from v8.1.1626:5ca1ac373a- setloclist and setqflist headers from:b0d45e7f53Correct eval.txt typo for settabwinvar method call (matches latest Vim).
This commit is contained in:
@@ -2992,7 +2992,11 @@ bufadd({name}) *bufadd()*
|
||||
number. Otherwise return the buffer number of the newly
|
||||
created buffer. When {name} is an empty string then a new
|
||||
buffer is always created.
|
||||
The buffer will not have' 'buflisted' set.
|
||||
The buffer will not have 'buflisted' set and not be loaded
|
||||
yet. To add some text to the buffer use this: >
|
||||
let bufnr = bufadd('someName')
|
||||
call bufload(bufnr)
|
||||
call setbufline(bufnr, 1, ['some', 'text'])
|
||||
< Can also be used as a |method|: >
|
||||
let bufnr = 'somename'->bufadd()
|
||||
|
||||
@@ -8704,7 +8708,7 @@ setline({lnum}, {text}) *setline()*
|
||||
Can also be used as a |method|, passing the text as the base: >
|
||||
GetText()->setline(lnum)
|
||||
|
||||
setloclist({nr}, {list}[, {action}[, {what}]]) *setloclist()*
|
||||
setloclist({nr}, {list} [, {action} [, {what}]]) *setloclist()*
|
||||
Create or replace or add to the location list for window {nr}.
|
||||
{nr} can be the window number or the |window-ID|.
|
||||
When {nr} is zero the current window is used.
|
||||
@@ -8720,6 +8724,10 @@ setloclist({nr}, {list}[, {action}[, {what}]]) *setloclist()*
|
||||
only the items listed in {what} are set. Refer to |setqflist()|
|
||||
for the list of supported keys in {what}.
|
||||
|
||||
Can also be used as a |method|, the base is passed as the
|
||||
second argument: >
|
||||
GetLoclist()->setloclist(winnr)
|
||||
|
||||
setmatches({list} [, {win}]) *setmatches()*
|
||||
Restores a list of matches saved by |getmatches() for the
|
||||
current window|. Returns 0 if successful, otherwise -1. All
|
||||
@@ -8728,6 +8736,9 @@ setmatches({list} [, {win}]) *setmatches()*
|
||||
If {win} is specified, use the window with this number or
|
||||
window ID instead of the current window.
|
||||
|
||||
Can also be used as a |method|: >
|
||||
GetMatches()->setmatches()
|
||||
<
|
||||
*setpos()*
|
||||
setpos({expr}, {list})
|
||||
Set the position for String {expr}. Possible values:
|
||||
@@ -8777,8 +8788,10 @@ setpos({expr}, {list})
|
||||
also set the preferred column. Also see the "curswant" key in
|
||||
|winrestview()|.
|
||||
|
||||
Can also be used as a |method|: >
|
||||
GetPosition()->setpos('.')
|
||||
|
||||
setqflist({list} [, {action}[, {what}]]) *setqflist()*
|
||||
setqflist({list} [, {action} [, {what}]]) *setqflist()*
|
||||
Create or replace or add to the quickfix list.
|
||||
|
||||
If the optional {what} dictionary argument is supplied, then
|
||||
@@ -8887,7 +8900,10 @@ setqflist({list} [, {action}[, {what}]]) *setqflist()*
|
||||
independent of the 'errorformat' setting. Use a command like
|
||||
`:cc 1` to jump to the first position.
|
||||
|
||||
|
||||
Can also be used as a |method|, the base is passed as the
|
||||
second argument: >
|
||||
GetErrorlist()->setqflist()
|
||||
<
|
||||
*setreg()*
|
||||
setreg({regname}, {value} [, {options}])
|
||||
Set the register {regname} to {value}.
|
||||
@@ -8944,6 +8960,10 @@ setreg({regname}, {value} [, {options}])
|
||||
nothing: >
|
||||
:call setreg('a', '', 'al')
|
||||
|
||||
< Can also be used as a |method|, the base is passed as the
|
||||
second argument: >
|
||||
GetText()->setreg('a')
|
||||
|
||||
settabvar({tabnr}, {varname}, {val}) *settabvar()*
|
||||
Set tab-local variable {varname} to {val} in tab page {tabnr}.
|
||||
|t:var|
|
||||
@@ -8952,6 +8972,9 @@ settabvar({tabnr}, {varname}, {val}) *settabvar()*
|
||||
Tabs are numbered starting with one.
|
||||
This function is not available in the |sandbox|.
|
||||
|
||||
Can also be used as a |method|, the base is used as the value: >
|
||||
GetValue()->settabvar(tab, name)
|
||||
|
||||
settabwinvar({tabnr}, {winnr}, {varname}, {val}) *settabwinvar()*
|
||||
Set option or local variable {varname} in window {winnr} to
|
||||
{val}.
|
||||
@@ -8968,6 +8991,9 @@ settabwinvar({tabnr}, {winnr}, {varname}, {val}) *settabwinvar()*
|
||||
:call settabwinvar(3, 2, "myvar", "foobar")
|
||||
< This function is not available in the |sandbox|.
|
||||
|
||||
Can also be used as a |method|, the base is used as the value: >
|
||||
GetValue()->settabwinvar(tab, winnr, name)
|
||||
|
||||
settagstack({nr}, {dict} [, {action}]) *settagstack()*
|
||||
Modify the tag stack of the window {nr} using {dict}.
|
||||
{nr} can be the window number or the |window-ID|.
|
||||
@@ -9001,6 +9027,8 @@ settagstack({nr}, {dict} [, {action}]) *settagstack()*
|
||||
call settagstack(1003, stack)
|
||||
unlet stack
|
||||
<
|
||||
Can also be used as a |method|, the base is used as the Dict: >
|
||||
GetStack()->settagstack(winnr)
|
||||
|
||||
setwinvar({nr}, {varname}, {val}) *setwinvar()*
|
||||
Like |settabwinvar()| for the current tab page.
|
||||
@@ -9008,10 +9036,16 @@ setwinvar({nr}, {varname}, {val}) *setwinvar()*
|
||||
:call setwinvar(1, "&list", 0)
|
||||
:call setwinvar(2, "myvar", "foobar")
|
||||
|
||||
< Can also be used as a |method|, the base is used as the value: >
|
||||
GetValue()->setwinvar(winnr, name)
|
||||
|
||||
sha256({string}) *sha256()*
|
||||
Returns a String with 64 hex characters, which is the SHA256
|
||||
checksum of {string}.
|
||||
|
||||
Can also be used as a |method|: >
|
||||
GetText()->sha256()
|
||||
|
||||
shellescape({string} [, {special}]) *shellescape()*
|
||||
Escape {string} for use as a shell command argument.
|
||||
|
||||
@@ -9043,6 +9077,8 @@ shellescape({string} [, {special}]) *shellescape()*
|
||||
:call system("chmod +w -- " . shellescape(expand("%")))
|
||||
< See also |::S|.
|
||||
|
||||
Can also be used as a |method|: >
|
||||
GetCommand()->shellescape()
|
||||
|
||||
shiftwidth([{col}]) *shiftwidth()*
|
||||
Returns the effective value of 'shiftwidth'. This is the
|
||||
@@ -9065,6 +9101,9 @@ shiftwidth([{col}]) *shiftwidth()*
|
||||
'vartabstop' feature. If no {col} argument is given, column 1
|
||||
will be assumed.
|
||||
|
||||
Can also be used as a |method|: >
|
||||
GetColumn()->shiftwidth()
|
||||
|
||||
sign_ functions are documented here: |sign-functions-details|
|
||||
|
||||
simplify({filename}) *simplify()*
|
||||
|
||||
Reference in New Issue
Block a user