docs: vimfn descriptions

This commit is contained in:
Justin M. Keyes
2026-03-11 19:42:27 +01:00
parent 96e6ce6619
commit bc67976c95
4 changed files with 716 additions and 742 deletions

View File

@@ -587,8 +587,8 @@ bufadd({name}) *bufadd()*
(`integer`)
bufexists({buf}) *bufexists()*
The result is a Number, which is |TRUE| if a buffer called
{buf} exists.
Checks whether a buffer with the name or number {buf} exists.
Returns |TRUE| if the buffer exists, |FALSE| otherwise.
If the {buf} argument is a number, buffer numbers are used.
Number zero is the alternate buffer for the current window.
@@ -615,8 +615,9 @@ bufexists({buf}) *bufexists()*
(`0|1`)
buflisted({buf}) *buflisted()*
The result is a Number, which is |TRUE| if a buffer called
{buf} exists and is listed (has the 'buflisted' option set).
Checks whether a buffer called {buf} exists and is listed
(has the 'buflisted' option set). Returns |TRUE| if so,
|FALSE| otherwise.
The {buf} argument is used like with |bufexists()|.
Parameters: ~
@@ -639,8 +640,9 @@ bufload({buf}) *bufload()*
• {buf} (`any`)
bufloaded({buf}) *bufloaded()*
The result is a Number, which is |TRUE| if a buffer called
{buf} exists and is loaded (shown in a window or hidden).
Checks whether a buffer called {buf} exists and is loaded
(shown in a window or hidden). Returns |TRUE| if so,
|FALSE| otherwise.
The {buf} argument is used like with |bufexists()|.
Parameters: ~
@@ -712,10 +714,10 @@ bufnr([{buf} [, {create}]]) *bufnr()*
(`integer`)
bufwinid({buf}) *bufwinid()*
The result is a Number, which is the |window-ID| of the first
window associated with buffer {buf}. For the use of {buf},
see |bufname()| above. If buffer {buf} doesn't exist or
there is no such window, -1 is returned. Example: >vim
Returns the |window-ID| of the first window associated with
buffer {buf}. For the use of {buf}, see |bufname()| above.
If buffer {buf} doesn't exist or there is no such window, -1
is returned. Example: >vim
echo "A window containing buffer 1 is " .. (bufwinid(1))
<
@@ -1099,8 +1101,8 @@ cmdcomplete_info() *cmdcomplete_info()*
(`table<string,any>`)
col({expr} [, {winid}]) *col()*
The result is a Number, which is the byte index of the column
position given with {expr}.
Returns the byte index of the column position given with
{expr}.
For accepted positions see |getpos()|.
When {expr} is "$", it means the end of the cursor line, so
the result is the number of bytes in the cursor line plus one.
@@ -1947,8 +1949,8 @@ exepath({expr}) *exepath()*
(`string`)
exists({expr}) *exists()*
The result is a Number, which is |TRUE| if {expr} is
defined, zero otherwise.
Checks whether the expression {expr} is defined.
Returns |TRUE| if {expr} is defined, zero otherwise.
For checking for a supported feature use |has()|.
For checking if a file exists use |filereadable()|.
@@ -2320,12 +2322,12 @@ filecopy({from}, {to}) *filecopy()*
(`0|1`)
filereadable({file}) *filereadable()*
The result is a Number, which is |TRUE| when a file with the
name {file} exists, and can be read. If {file} doesn't exist,
or is a directory, the result is |FALSE|. {file} is any
expression, which is used as a String.
If you don't care about the file being readable you can use
|glob()|.
Returns |TRUE| if {file} exists, can be read, and is not
a directory, else |FALSE|.
{file} is any expression, which is used as a String. If you
don't care about the file being readable you can use |glob()|.
{file} is used as-is, you may want to expand wildcards first: >vim
echo filereadable('~/.vimrc')
< >
@@ -2343,9 +2345,9 @@ filereadable({file}) *filereadable()*
(`0|1`)
filewritable({file}) *filewritable()*
The result is a Number, which is 1 when a file with the
name {file} exists, and can be written. If {file} doesn't
exist, or is not writable, the result is 0. If {file} is a
Checks whether a file with the name {file} exists and can
be written. Returns 1 if so. If {file} doesn't exist, or
is not writable, the result is 0. If {file} is a
directory, and we can write to it, the result is 2.
Parameters: ~
@@ -2611,9 +2613,9 @@ fnamemodify({fname}, {mods}) *fnamemodify()*
(`string`)
foldclosed({lnum}) *foldclosed()*
The result is a Number. If the line {lnum} is in a closed
fold, the result is the number of the first line in that fold.
If the line {lnum} is not in a closed fold, -1 is returned.
Returns the first line number of the closed fold containing
line {lnum}. If the line {lnum} is not in a closed fold,
-1 is returned.
{lnum} is used like with |getline()|. Thus "." is the current
line, "'m" mark m, etc.
@@ -2624,9 +2626,9 @@ foldclosed({lnum}) *foldclosed()*
(`integer`)
foldclosedend({lnum}) *foldclosedend()*
The result is a Number. If the line {lnum} is in a closed
fold, the result is the number of the last line in that fold.
If the line {lnum} is not in a closed fold, -1 is returned.
Returns the last line number of the closed fold containing
line {lnum}. If the line {lnum} is not in a closed fold,
-1 is returned.
{lnum} is used like with |getline()|. Thus "." is the current
line, "'m" mark m, etc.
@@ -2637,16 +2639,17 @@ foldclosedend({lnum}) *foldclosedend()*
(`integer`)
foldlevel({lnum}) *foldlevel()*
The result is a Number, which is the foldlevel of line {lnum}
in the current buffer. For nested folds the deepest level is
returned. If there is no fold at line {lnum}, zero is
returned. It doesn't matter if the folds are open or closed.
When used while updating folds (from 'foldexpr') -1 is
returned for lines where folds are still to be updated and the
foldlevel is unknown. As a special case the level of the
previous line is usually available.
{lnum} is used like with |getline()|. Thus "." is the current
line, "'m" mark m, etc.
Returns the fold nesting level of line {lnum} in the current
buffer. {lnum} is used like with |getline()| ("." is the
current line, "'m" mark m, etc).
For nested folds the deepest level is returned. If there is
no fold at line {lnum}, zero is returned. It doesn't matter
if the folds are open or closed. When used while updating
folds (from 'foldexpr') -1 is returned for lines where folds
are still to be updated and the foldlevel is unknown. As
a special case the level of the previous line is usually
available.
Parameters: ~
• {lnum} (`integer|string`)
@@ -3238,8 +3241,8 @@ getchar([{expr} [, {opts}]]) *getchar()*
(`integer|string`)
getcharmod() *getcharmod()*
The result is a Number which is the state of the modifiers for
the last obtained character with |getchar()| or in another way.
Returns the state of the keyboard modifiers for the last
character obtained with |getchar()| or in another way.
These values are added together:
2 shift
4 control
@@ -3613,10 +3616,9 @@ getfontname([{name}]) *getfontname()*
(`string`)
getfperm({fname}) *getfperm()*
The result is a String, which is the read, write, and execute
permissions of the given file {fname}.
If {fname} does not exist or its directory cannot be read, an
empty string is returned.
Returns the file permissions of the given file {fname} as a
String. If {fname} does not exist or its directory cannot be
read, an empty string is returned.
The result is of the form "rwxrwxrwx", where each group of
"rwx" flags represent, in turn, the permissions of the owner
of the file, the group the file belongs to, and other users.
@@ -3636,8 +3638,7 @@ getfperm({fname}) *getfperm()*
(`string`)
getfsize({fname}) *getfsize()*
The result is a Number, which is the size in bytes of the
given file {fname}.
Returns the size in bytes of the given file {fname}.
If {fname} is a directory, 0 is returned.
If the file {fname} can't be found, -1 is returned.
If the size of {fname} is too big to fit in a Number then -2
@@ -3650,9 +3651,9 @@ getfsize({fname}) *getfsize()*
(`integer`)
getftime({fname}) *getftime()*
The result is a Number, which is the last modification time of
the given file {fname}. The value is measured as seconds
since 1st Jan 1970, and may be passed to |strftime()|. See also
Returns the last modification time of the given file {fname}.
The value is measured as seconds since 1st Jan 1970, and may
be passed to |strftime()|. See also
|localtime()| and |strftime()|.
If the file {fname} can't be found -1 is returned.
@@ -3663,9 +3664,9 @@ getftime({fname}) *getftime()*
(`integer`)
getftype({fname}) *getftype()*
The result is a String, which is a description of the kind of
file of the given file {fname}.
If {fname} does not exist an empty string is returned.
Returns a description of the type of file {fname} as a
String. If {fname} does not exist an empty string is
returned.
Here is a table over different kinds of files and their
results:
Normal file "file"
@@ -4069,8 +4070,8 @@ getqflist([{what}]) *getqflist()*
(`any`)
getreg([{regname} [, 1 [, {list}]]]) *getreg()*
The result is a String, which is the contents of register
{regname}. Example: >vim
Returns the contents of register {regname} as a String.
Example: >vim
let cliptext = getreg('*')
< When register {regname} was not set the result is an empty
string.
@@ -4240,7 +4241,7 @@ getregionpos({pos1}, {pos2} [, {opts}]) *getregionpos()*
(`[ [integer, integer, integer, integer], [integer, integer, integer, integer] ][]`)
getregtype([{regname}]) *getregtype()*
The result is a String, which is type of register {regname}.
Returns the type of register {regname} as a String.
The value will be one of:
"v" for |charwise| text
"V" for |linewise| text
@@ -4388,7 +4389,7 @@ gettabwinvar({tabnr}, {winnr}, {varname} [, {def}]) *gettabwinvar()*
(`any`)
gettagstack([{winnr}]) *gettagstack()*
The result is a Dict, which is the tag stack of window {winnr}.
Returns the tag stack of window {winnr} as a Dict.
{winnr} can be the window number or the |window-ID|.
When {winnr} is not specified, the current window is used.
When window {winnr} doesn't exist, an empty Dict is returned.
@@ -4482,11 +4483,12 @@ getwininfo([{winid}]) *getwininfo()*
(`vim.fn.getwininfo.ret.item[]`)
getwinpos([{timeout}]) *getwinpos()*
The result is a |List| with two numbers, the result of
|getwinposx()| and |getwinposy()| combined:
[x-pos, y-pos]
Returns the [x, y] screen position of the Nvim GUI window as
a |List| with two numbers (result of |getwinposx()| and
|getwinposy()| combined).
{timeout} can be used to specify how long to wait in msec for
a response from the terminal. When omitted 100 msec is used.
a response. When omitted 100 msec is used.
Use a longer time for a remote terminal.
When using a value less than 10 and no response is received
@@ -4509,19 +4511,17 @@ getwinpos([{timeout}]) *getwinpos()*
(`any`)
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
-1 if the information is not available.
The value can be used with `:winpos`.
Returns the X coordinate in pixels of the left hand side of
the Nvim GUI window, or -1 if not available. The value can be
used with `:winpos`.
Return: ~
(`integer`)
getwinposy() *getwinposy()*
The result is a Number, which is the Y coordinate in pixels of
the top of the GUI Vim window. The result will be -1 if the
information is not available.
The value can be used with `:winpos`.
Returns the Y coordinate in pixels of the top of the Nvim GUI
window, or -1 if not available. The value can be used with
`:winpos`.
Return: ~
(`integer`)
@@ -4729,8 +4729,8 @@ has({feature}) *has()*
(`0|1`)
has_key({dict}, {key}) *has_key()*
The result is a Number, which is TRUE if |Dictionary| {dict}
has an entry with key {key}. FALSE otherwise. The {key}
Checks whether |Dictionary| {dict} has an entry with key
{key}. Returns TRUE if so, FALSE otherwise. The {key}
argument is a string.
Parameters: ~
@@ -4741,9 +4741,10 @@ has_key({dict}, {key}) *has_key()*
(`0|1`)
haslocaldir([{winnr} [, {tabnr}]]) *haslocaldir()*
The result is a Number, which is 1 when the window has set a
local path via |:lcd| or when {winnr} is -1 and the tabpage
has set a local path via |:tcd|, otherwise 0.
Checks whether the window or tabpage has set a local working
directory. Returns 1 when the window has set a local path
via |:lcd| or when {winnr} is -1 and the tabpage has set a
local path via |:tcd|, otherwise 0.
Tabs and windows are identified by their respective numbers,
0 means current tab or window. Missing argument implies 0.
@@ -4765,9 +4766,8 @@ haslocaldir([{winnr} [, {tabnr}]]) *haslocaldir()*
(`0|1`)
hasmapto({what} [, {mode} [, {abbr}]]) *hasmapto()*
The result is a Number, which is TRUE if there is a mapping
that contains {what} in somewhere in the rhs (what it is
mapped to) and this mapping exists in one of the modes
Checks whether a mapping exists whose rhs contains {what}.
Returns TRUE if there is such a mapping in one of the modes
indicated by {mode}.
The arguments {what} and {mode} are strings.
When {abbr} is there and it is |TRUE| use abbreviations
@@ -4872,9 +4872,9 @@ histdel({history} [, {item}]) *histdel()*
(`0|1`)
histget({history} [, {index}]) *histget()*
The result is a String, the entry with Number {index} from
{history}. See |hist-names| for the possible values of
{history}, and |:history-indexing| for {index}. If there is
Returns an entry from the specified command-line {history}.
See |hist-names| for the possible values of {history}, and
|:history-indexing| for {index}. If there is
no such entry, an empty String is returned. When {index} is
omitted, the most recent item from the history is used.
@@ -4910,9 +4910,9 @@ histnr({history}) *histnr()*
(`integer`)
hlID({name}) *hlID()*
The result is a Number, which is the ID of the highlight group
with name {name}. When the highlight group doesn't exist,
zero is returned.
Returns the numeric ID of the highlight group with name
{name}. When the highlight group doesn't exist, zero is
returned.
This can be used to retrieve information about the highlight
group. For example, to get the background color of the
"Comment" group: >vim
@@ -4926,11 +4926,10 @@ hlID({name}) *hlID()*
(`integer`)
hlexists({name}) *hlexists()*
The result is a Number, which is TRUE if a highlight group
called {name} exists. This is when the group has been
defined in some way. Not necessarily when highlighting has
been defined for it, it may also have been used for a syntax
item.
Checks whether a highlight group called {name} exists.
Returns TRUE if the group has been defined in some way. Not
necessarily when highlighting has been defined for it, it may
also have been used for a syntax item.
Parameters: ~
• {name} (`string`)
@@ -4939,16 +4938,16 @@ hlexists({name}) *hlexists()*
(`0|1`)
hostname() *hostname()*
The result is a String, which is the name of the machine on
which Vim is currently running. Machine names greater than
Returns the hostname of the machine on which the Nvim server
(not the UI client) is currently running. Names greater than
256 characters long are truncated.
Return: ~
(`string`)
iconv({string}, {from}, {to}) *iconv()*
The result is a String, which is the text {string} converted
from encoding {from} to encoding {to}.
Converts the encoding of {string} from {from} to {to}.
Returns the converted String.
When the conversion completely fails an empty string is
returned. When some characters could not be converted they
are replaced with "?".
@@ -4990,9 +4989,9 @@ id({expr}) *id()*
(`string`)
indent({lnum}) *indent()*
The result is a Number, which is indent of line {lnum} in the
current buffer. The indent is counted in spaces, the value
of 'tabstop' is relevant. {lnum} is used just like in
Returns the indent of line {lnum} in the current buffer.
The indent is counted in spaces, the value of 'tabstop' is
relevant. {lnum} is used just like in
|getline()|.
When {lnum} is invalid -1 is returned.
@@ -5099,10 +5098,10 @@ input({prompt} [, {text} [, {completion}]]) *input()*
(`string`)
input({opts})
The result is a String, which is whatever the user typed on
the command-line. The {prompt} argument is either a prompt
string, or a blank string (for no prompt). A '\n' can be used
in the prompt to start a new line.
Prompts the user to enter text on the command-line, and
returns the text as a String. The {prompt} argument is either
a prompt string, or a blank string (for no prompt). A '\n'
can be used in the prompt to start a new line.
In the second form it accepts a single dictionary with the
following keys, any of which may be omitted:
@@ -5216,9 +5215,9 @@ input({opts})
(`string`)
inputlist({textlist}) *inputlist()*
{textlist} must be a |List| of strings. This |List| is
displayed, one string per line. The user will be prompted to
enter a number, which is returned.
Displays a list of strings and prompts the user to select
one by entering a number. {textlist} must be a |List| of
strings. Returns the number the user entered.
The user can also select an item by clicking on it with the
mouse, if the mouse is enabled in the command line ('mouse' is
"a" or includes "c"). For the first string 0 is returned.
@@ -5333,8 +5332,8 @@ invert({expr}) *invert()*
(`integer`)
isabsolutepath({path}) *isabsolutepath()*
The result is a Number, which is |TRUE| when {path} is an
absolute path.
Checks whether {path} is an absolute path. Returns |TRUE|
if so, |FALSE| otherwise.
On Unix, a path is considered absolute when it starts with
'/'.
On MS-Windows, it is considered absolute when it starts with
@@ -5355,10 +5354,9 @@ isabsolutepath({path}) *isabsolutepath()*
(`0|1`)
isdirectory({directory}) *isdirectory()*
The result is a Number, which is |TRUE| when a directory
with the name {directory} exists. If {directory} doesn't
exist, or isn't a directory, the result is |FALSE|. {directory}
is any expression, which is used as a String.
Returns |TRUE| if {directory} exists, or |FALSE| if it doesn't
exist or isn't a directory. {directory} is any expression,
which is used as a String.
Parameters: ~
• {directory} (`string`)
@@ -5381,8 +5379,8 @@ isinf({expr}) *isinf()*
(`1|0|-1`)
islocked({expr}) *islocked()* *E786*
The result is a Number, which is |TRUE| when {expr} is the
name of a locked variable.
Returns |TRUE| if {expr} is the name of a locked variable,
else |FALSE|.
The string argument {expr} must be the name of a variable,
|List| item or |Dictionary| entry, not the variable itself!
Example: >vim
@@ -5684,7 +5682,7 @@ keytrans({string}) *keytrans()*
(`string`)
len({expr}) *len()* *E701*
The result is a Number, which is the length of the argument.
Returns the length of the argument.
When {expr} is a String or a Number the length in bytes is
used, as with |strlen()|.
When {expr} is a |List| the number of items in the |List| is
@@ -8220,11 +8218,11 @@ screenattr({row}, {col}) *screenattr()*
(`integer`)
screenchar({row}, {col}) *screenchar()*
The result is a Number, which is the character at position
[row, col] on the screen. This works for every possible
screen position, also status lines, window separators and the
command line. The top left position is row one, column one
The character excludes composing characters. For double-byte
Returns the character at screen position [row, col] as a
Number. This works for every possible screen position, also
status lines, window separators and the command line. The
top left position is row one, column one. The character
excludes composing characters. For double-byte
encodings it may only be the first byte.
This is mainly to be used for testing.
Returns -1 when row or col is out of range.
@@ -8237,9 +8235,10 @@ screenchar({row}, {col}) *screenchar()*
(`integer`)
screenchars({row}, {col}) *screenchars()*
The result is a |List| of Numbers. The first number is the same
as what |screenchar()| returns. Further numbers are
composing characters on top of the base character.
Returns the character and any composing characters at screen
position [row, col] as a |List| of Numbers. The first number
is the same as what |screenchar()| returns; further numbers
are composing characters on top of the base character.
This is mainly to be used for testing.
Returns an empty List when row or col is out of range.
@@ -8251,8 +8250,8 @@ screenchars({row}, {col}) *screenchars()*
(`integer[]`)
screencol() *screencol()*
The result is a Number, which is the current screen column of
the cursor. The leftmost column has number 1.
Returns the current screen column of the cursor. The
leftmost column has number 1.
This function is mainly used for testing.
Note: Always returns the current screen column, thus if used
@@ -8269,9 +8268,9 @@ screencol() *screencol()*
(`integer`)
screenpos({winid}, {lnum}, {col}) *screenpos()*
The result is a Dict with the screen position of the text
character in window {winid} at buffer line {lnum} and column
{col}. {col} is a one-based byte index.
Returns the screen position of the text character in window
{winid} at buffer line {lnum} and column {col} as a Dict.
{col} is a one-based byte index.
The Dict has these members:
row screen row
col first screen column
@@ -8301,8 +8300,8 @@ screenpos({winid}, {lnum}, {col}) *screenpos()*
(`{ col: integer, curscol: integer, endcol: integer, row: integer }`)
screenrow() *screenrow()*
The result is a Number, which is the current screen row of the
cursor. The top line has number one.
Returns the current screen row of the cursor. The top line
has number one.
This function is mainly used for testing.
Alternatively you can use |winline()|.
@@ -8312,10 +8311,9 @@ screenrow() *screenrow()*
(`integer`)
screenstring({row}, {col}) *screenstring()*
The result is a String that contains the base character and
any composing characters at position [row, col] on the screen.
This is like |screenchars()| but returning a String with the
characters.
Returns the base character and any composing characters at
screen position [row, col] as a String. This is like
|screenchars()| but returning a String with the characters.
This is mainly to be used for testing.
Returns an empty String when row or col is out of range.
@@ -10478,13 +10476,12 @@ str2nr({string} [, {base}]) *str2nr()*
(`any`)
strcharlen({string}) *strcharlen()*
The result is a Number, which is the number of characters
in String {string}. Composing characters are ignored.
Returns the number of characters in String {string}, ignoring
composing characters. Returns 0 on error or empty {string}.
|strchars()| can count the number of characters, counting
composing characters separately.
Returns 0 if {string} is empty or on error.
Also see |strlen()|, |strdisplaywidth()| and |strwidth()|.
Parameters: ~
@@ -10518,8 +10515,7 @@ strcharpart({src}, {start} [, {len} [, {skipcc}]]) *strcharpart()*
(`string`)
strchars({string} [, {skipcc}]) *strchars()*
The result is a Number, which is the number of characters
in String {string}.
Returns the number of characters in String {string}.
When {skipcc} is omitted or zero, composing characters are
counted separately.
When {skipcc} set to 1, composing characters are ignored.
@@ -10554,18 +10550,20 @@ strchars({string} [, {skipcc}]) *strchars()*
(`integer`)
strdisplaywidth({string} [, {col}]) *strdisplaywidth()*
The result is a Number, which is the number of display cells
String {string} occupies on the screen when it starts at {col}
(first column is zero). When {col} is omitted zero is used.
Otherwise it is the screen column where to start. This
matters for Tab characters.
Returns the number of display cells String {string} occupies
on the screen when it starts at {col} (first column is zero).
Returns zero on error.
When {col} is omitted zero is used. Otherwise it is the screen
column where to start. This matters for Tab characters.
The option settings of the current window are used. This
matters for anything that's displayed differently, such as
'tabstop' and 'display'.
When {string} contains characters with East Asian Width Class
Ambiguous, this function's return value depends on
'ambiwidth'.
Returns zero on error.
Also see |strlen()|, |strwidth()| and |strchars()|.
Parameters: ~
@@ -10576,10 +10574,9 @@ strdisplaywidth({string} [, {col}]) *strdisplaywidth()*
(`integer`)
strftime({format} [, {time}]) *strftime()*
The result is a String, which is a formatted date and time, as
specified by the {format} string. The given {time} is used,
or the current time if no time is given. The accepted
{format} depends on your system, thus this is not portable!
Formats a date and time String specified by {format}. The
given {time} is used, or the current time if no time is given.
The {format} depends on your system, this is not portable!
See the manual page of the C function strftime() for the
format. The maximum length of the result is 80 characters.
See also |localtime()|, |getftime()| and |strptime()|.
@@ -10617,8 +10614,8 @@ strgetchar({str}, {index}) *strgetchar()*
(`integer`)
stridx({haystack}, {needle} [, {start}]) *stridx()*
The result is a Number, which gives the byte index in
{haystack} of the first occurrence of the String {needle}.
Returns the byte index of the first occurrence of {needle}
in {haystack}.
If {start} is specified, the search starts at index {start}.
This can be used to find a second match: >vim
let colon1 = stridx(line, ":")
@@ -10644,9 +10641,10 @@ stridx({haystack}, {needle} [, {start}]) *stridx()*
(`integer`)
string({expr}) *string()*
Return {expr} converted to a String. If {expr} is a Number,
Float, String, Blob or a composition of them, then the result
can be parsed back with |eval()|.
Converts {expr} to a String. If {expr} is a Number, Float,
String, Blob or a composition of them, the result can be
parsed back with |eval()|.
{expr} type result ~
String 'string'
Number 123
@@ -10656,14 +10654,16 @@ string({expr}) *string()*
Blob 0z00112233.44556677.8899
List [item, item]
Dictionary `{key: value, key: value}`
Note that in String values the ' character is doubled.
Note: in String values the ' character is doubled.
Also see |strtrans()|.
Note 2: Output format is mostly compatible with YAML, except
for infinite and NaN floating-point values representations
which use |str2float()|. Strings are also dumped literally,
only single quote is escaped, which does not allow using YAML
for parsing back binary strings. |eval()| should always work
for strings and floats though, and this is the only official
Note: Output format is mostly compatible with YAML, except for
infinite and NaN floating-point values representations which
use |str2float()|. Strings are also dumped literally, only
single quote is escaped, which does not allow using YAML for
parsing back binary strings. |eval()| should always work for
strings and floats though, and this is the only official
method. Use |msgpackdump()| or |json_encode()| if you need to
share data with other applications.
@@ -10674,8 +10674,7 @@ string({expr}) *string()*
(`string`)
strlen({string}) *strlen()*
The result is a Number, which is the length of the String
{string} in bytes.
Returns the length of String {string} in bytes.
If the argument is a Number it is first converted to a String.
For other types an error is given and zero is returned.
If you want to count the number of multibyte characters use
@@ -10689,12 +10688,14 @@ strlen({string}) *strlen()*
(`integer`)
strpart({src}, {start} [, {len} [, {chars}]]) *strpart()*
The result is a String, which is part of {src}, starting from
byte {start}, with the byte length {len}.
Gets a substring from {src}, starting from byte {start}, with
byte length {len}. Returns empty string on error.
When {chars} is present and TRUE then {len} is the number of
characters positions (composing characters are not counted
separately, thus "1" means one base character and any
following composing characters).
To count {start} as characters instead of bytes use
|strcharpart()|.
@@ -10711,7 +10712,6 @@ strpart({src}, {start} [, {len} [, {chars}]]) *strpart()*
example, to get the character under the cursor: >vim
strpart(getline("."), col(".") - 1, 1, v:true)
<
Returns an empty string on error.
Parameters: ~
• {src} (`string`)
@@ -10723,14 +10723,12 @@ strpart({src}, {start} [, {len} [, {chars}]]) *strpart()*
(`string`)
strptime({format}, {timestring}) *strptime()*
The result is a Number, which is a unix timestamp representing
the date and time in {timestring}, which is expected to match
the format specified in {format}.
Parses a date/time string and returns a unix timestamp.
{timestring} must match the format specified in {format}.
The accepted {format} depends on your system, thus this is not
portable! See the manual page of the C function strptime()
for the format. Especially avoid "%c". The value of $TZ also
matters.
The {format} depends on your system, this is not portable!
See the strptime() manpage for the format. Especially avoid
"%c". The value of $TZ also matters.
If the {timestring} cannot be parsed with {format} zero is
returned. If you do not know the format of {timestring} you
@@ -10754,8 +10752,8 @@ strptime({format}, {timestring}) *strptime()*
(`integer`)
strridx({haystack}, {needle} [, {start}]) *strridx()*
The result is a Number, which gives the byte index in
{haystack} of the last occurrence of the String {needle}.
Returns the byte index of the last occurrence of {needle}
in {haystack}.
When {start} is specified, matches beyond this index are
ignored. This can be used to find a match before a previous
match: >vim
@@ -10780,9 +10778,9 @@ strridx({haystack}, {needle} [, {start}]) *strridx()*
(`integer`)
strtrans({string}) *strtrans()*
The result is a String, which is {string} with all unprintable
characters translated into printable characters 'isprint'.
Like they are shown in a window. Example: >vim
Translates all unprintable characters in {string} into
printable characters 'isprint', like they are shown in a
window. Example: >vim
echo strtrans(@a)
< This displays a newline in register a as "^@" instead of
starting a new line.
@@ -10796,8 +10794,8 @@ strtrans({string}) *strtrans()*
(`string`)
strutf16len({string} [, {countcc}]) *strutf16len()*
The result is a Number, which is the number of UTF-16 code
units in String {string} (after converting it to UTF-16).
Returns the number of UTF-16 code units in String {string}
(after converting it to UTF-16).
When {countcc} is TRUE, composing characters are counted
separately.
@@ -10823,9 +10821,9 @@ strutf16len({string} [, {countcc}]) *strutf16len()*
(`integer`)
strwidth({string}) *strwidth()*
The result is a Number, which is the number of display cells
String {string} occupies. A Tab character is counted as one
cell, alternatively use |strdisplaywidth()|.
Returns the number of display cells String {string} occupies.
A Tab character is counted as one cell, alternatively use
|strdisplaywidth()|.
When {string} contains characters with East Asian Width Class
Ambiguous, this function's return value depends on
'ambiwidth'.
@@ -10874,8 +10872,8 @@ submatch({nr} [, {list}]) *submatch()* *E93
(`string`)
substitute({string}, {pat}, {sub}, {flags}) *substitute()*
The result is a String, which is a copy of {string}, in which
the first match of {pat} is replaced with {sub}.
Performs string substitution. Returns a copy of {string}
in which the first match of {pat} is replaced with {sub}.
When {flags} is "g", all matches of {pat} in {string} are
replaced. Otherwise {flags} should be "".
@@ -10941,8 +10939,8 @@ swapfilelist() *swapfilelist()*
(`string[]`)
swapinfo({fname}) *swapinfo()*
The result is a dictionary, which holds information about the
swapfile {fname}. The available fields are:
Returns information about the swapfile {fname} as a
dictionary. The available fields are:
version Vim version
user user name
host host name
@@ -10978,10 +10976,9 @@ swapname({buf}) *swapname()*
(`string`)
synID({lnum}, {col}, {trans}) *synID()*
The result is a Number, which is the syntax ID at the position
{lnum} and {col} in the current window.
The syntax ID can be used with |synIDattr()| and
|synIDtrans()| to obtain syntax information about text.
Returns the syntax ID at position {lnum} and {col} in the
current window. The syntax ID can be used with |synIDattr()|
and |synIDtrans()| to obtain syntax information about text.
{col} is 1 for the leftmost column, {lnum} is 1 for the first
line. 'synmaxcol' applies, in a longer line zero is returned.
@@ -11012,9 +11009,9 @@ synID({lnum}, {col}, {trans}) *synID()*
(`integer`)
synIDattr({synID}, {what} [, {mode}]) *synIDattr()*
The result is a String, which is the {what} attribute of
syntax ID {synID}. This can be used to obtain information
about a syntax item.
Returns the {what} attribute of syntax ID {synID} as a
String. This can be used to obtain information about a
syntax item.
{mode} can be "gui" or "cterm", to get the attributes
for that mode. When {mode} is omitted, or an invalid value is
used, the attributes for the currently active highlighting are
@@ -11070,9 +11067,9 @@ synIDattr({synID}, {what} [, {mode}]) *synIDattr()*
(`string`)
synIDtrans({synID}) *synIDtrans()*
The result is a Number, which is the translated syntax ID of
{synID}. This is the syntax group ID of what is being used to
highlight the character. Highlight links given with
Returns the translated syntax ID of {synID}, following
highlight links. This is the syntax group ID of what is
being used to highlight the character. Highlight links given with
":highlight link" are followed.
Returns zero on error.
@@ -11084,10 +11081,11 @@ synIDtrans({synID}) *synIDtrans()*
(`integer`)
synconcealed({lnum}, {col}) *synconcealed()*
The result is a |List| with three items:
1. The first item in the list is 0 if the character at the
position {lnum} and {col} is not part of a concealable
region, 1 if it is. {lnum} is used like with |getline()|.
Returns conceal information for the character at position
{lnum} and {col} as a |List| with three items:
1. The first item in the list is 0 if the character is not
part of a concealable region, 1 if it is. {lnum} is used
like with |getline()|.
2. The second item in the list is a string. If the first item
is 1, the second item contains the text which will be
displayed in place of the concealed text, depending on the
@@ -11224,8 +11222,8 @@ systemlist({cmd} [, {input} [, {keepempty}]]) *systemlist()*
(`string[]`)
tabpagebuflist([{arg}]) *tabpagebuflist()*
The result is a |List|, where each item is the number of the
buffer associated with each window in the current tab page.
Returns a |List| of buffer numbers, one for each window in
the specified tab page.
{arg} specifies the number of the tab page to be used. When
omitted the current tab page is used.
When {arg} is invalid the number zero is returned.
@@ -11243,8 +11241,8 @@ tabpagebuflist([{arg}]) *tabpagebuflist()*
(`any`)
tabpagenr([{arg}]) *tabpagenr()*
The result is a Number, which is the number of the current
tab page. The first tab page has number 1.
Returns the number of the current tab page. The first tab
page has number 1.
The optional argument {arg} supports the following values:
$ the number of the last tab page (the tab page
@@ -11492,9 +11490,8 @@ timer_stopall() *timer_stopall()*
(`any`)
tolower({expr}) *tolower()*
The result is a copy of the String given, with all uppercase
characters turned into lowercase (just like applying |gu| to
the string). Returns an empty string on error.
Converts a String to lowercase (like applying |gu|).
Returns empty string on error.
Parameters: ~
• {expr} (`string`)
@@ -11503,9 +11500,8 @@ tolower({expr}) *tolower()*
(`string`)
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). Returns an empty string on error.
Converts a String to uppercase (like applying |gU|).
Returns empty string on error.
Parameters: ~
• {expr} (`string`)
@@ -11514,11 +11510,9 @@ toupper({expr}) *toupper()*
(`string`)
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
position in the {tostr} string. Thus the first character in
{fromstr} is translated into the first character in {tostr}
and so on. Exactly like the unix "tr" command.
Translates characters in {src}, replacing each character that
appears in {fromstr} with the corresponding character in
{tostr}. Exactly like the unix "tr" command.
This code also deals with multibyte characters properly.
Returns an empty string on error.
@@ -11593,7 +11587,7 @@ trunc({expr}) *trunc()*
(`integer`)
type({expr}) *type()*
The result is a Number representing the type of {expr}.
Returns the type of {expr} as a Number.
Instead of using the number directly, it is better to use the
v:t_ variable that has the value:
Number: 0 |v:t_number|
@@ -11764,10 +11758,10 @@ values({dict}) *values()*
(`any`)
virtcol({expr} [, {list} [, {winid}]]) *virtcol()*
The result is a Number, which is the screen column of the file
position given with {expr}. That is, the total number of
screen cells occupied by the part of the line until the end of
the character at that position. When there is a <Tab> at the
Returns the virtual (screen) column of the file position
given with {expr}. That is, the total number of screen cells
occupied by the part of the line until the end of the
character at that position. When there is a <Tab> at the
position, the returned Number will be the column at the end of
the <Tab>. For example, for a <Tab> in column 1, with 'ts'
set to 8, it returns 8. |conceal| is ignored.
@@ -11820,9 +11814,9 @@ virtcol({expr} [, {list} [, {winid}]]) *virtcol()*
(`integer|[integer, integer]`)
virtcol2col({winid}, {lnum}, {col}) *virtcol2col()*
The result is a Number, which is the byte index of the
character in window {winid} at buffer line {lnum} and virtual
column {col}.
Converts a virtual column to a byte index. Returns the byte
index of the character in window {winid} at buffer line
{lnum} and virtual column {col}.
If buffer line {lnum} is an empty line, 0 is returned.
@@ -11850,9 +11844,9 @@ virtcol2col({winid}, {lnum}, {col}) *virtcol2col()*
(`integer`)
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",
Returns a String describing 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",
"V", or "<CTRL-V>" (a single CTRL-V character) for
character-wise, line-wise, or block-wise Visual mode
respectively.
@@ -12124,9 +12118,8 @@ win_splitmove({nr}, {target} [, {options}]) *win_splitmove()*
(`any`)
winbufnr({nr}) *winbufnr()*
The result is a Number, which is the number of the buffer
associated with window {nr}. {nr} can be the window number or
the |window-ID|.
Returns the buffer number associated with window {nr}.
{nr} can be the window number or the |window-ID|.
When {nr} is zero, the number of the buffer in the current
window is returned.
When window {nr} doesn't exist, -1 is returned.
@@ -12141,18 +12134,19 @@ winbufnr({nr}) *winbufnr()*
(`integer`)
wincol() *wincol()*
The result is a Number, which is the virtual column of the
cursor in the window. This is counting screen cells from the
left side of the window. The leftmost column is one.
Returns the virtual column of the cursor in the window.
This is counting screen cells from the left side of the
window. The leftmost column is one.
Return: ~
(`integer`)
windowsversion() *windowsversion()*
The result is a String. For MS-Windows it indicates the OS
version. E.g, Windows 10 is "10.0", Windows 8 is "6.2",
Windows XP is "5.1". For non-MS-Windows systems the result is
an empty string.
Returns the Windows OS version as a String. E.g, Windows 10
is "10.0", Windows 8 is "6.2", Windows XP is "5.1". For
non-MS-Windows systems the result is an empty string.
See also Lua |uv.os_uname()|.
Return: ~
(`string`)
@@ -12174,8 +12168,7 @@ winheight({nr}) *winheight()*
(`integer`)
winlayout([{tabnr}]) *winlayout()*
The result is a nested List containing the layout of windows
in a tabpage.
Returns the layout of windows in a tabpage as a nested List.
Without {tabnr} use the current tabpage, otherwise the tabpage
with number {tabnr}. If the tabpage {tabnr} is not found,
@@ -12217,9 +12210,9 @@ winlayout([{tabnr}]) *winlayout()*
(`vim.fn.winlayout.ret`)
winline() *winline()*
The result is a Number, which is the screen line of the cursor
in the window. This is counting screen lines from the top of
the window. The first line is one.
Returns the screen line of the cursor in the window. This is
counting screen lines from the top of the window. The first
line is one.
If the cursor was moved the view on the file will be updated
first, this may cause a scroll.
@@ -12227,10 +12220,9 @@ winline() *winline()*
(`integer`)
winnr([{arg}]) *winnr()*
The result is a Number, which is the number of the current
window. The top window has number 1.
Returns zero for a hidden or non |focusable| window, unless
it is the current window.
Returns the number of the current window. The top window has
number 1. Returns zero for a hidden or non |focusable|
window, unless it is the current window.
The optional argument {arg} supports the following values:
$ the number of the last window (the window
@@ -12356,9 +12348,8 @@ winwidth({nr}) *winwidth()*
(`integer`)
wordcount() *wordcount()*
The result is a dictionary of byte/chars/word statistics for
the current buffer. This is the same info as provided by
|g_CTRL-G|
Returns a dictionary of byte/chars/word statistics for the
current buffer. This is the same info provided by |g_CTRL-G|.
The return value includes:
bytes Number of bytes in the buffer
chars Number of chars in the buffer

View File

@@ -4565,11 +4565,13 @@ vim.bo.ma = vim.bo.modifiable
--- result of a BufNewFile, BufRead/BufReadPost, BufWritePost,
--- FileAppendPost or VimLeave autocommand event. See `gzip-example` for
--- an explanation.
---
--- When 'buftype' is "prompt", 'modified' is not implicitly set when the
--- buffer is changed, but a user or plugin may explicitly set it.
---
--- When 'buftype' is "nowrite" or "nofile", this option may be set, but
--- it is ignored and will not block closing the window. For "prompt"
--- buffers, changes made to the buffer do not make it count as modified,
--- but an explicit ":set modified" is respected and will block closing the
--- window.
--- will be ignored.
---
--- Note that the text may actually be the same, e.g. 'modified' is set
--- when using "rA" on an "A".
---

View File

@@ -486,8 +486,8 @@ function vim.fn.browsedir(title, initdir) end
--- @return integer
function vim.fn.bufadd(name) end
--- The result is a Number, which is |TRUE| if a buffer called
--- {buf} exists.
--- Checks whether a buffer with the name or number {buf} exists.
--- Returns |TRUE| if the buffer exists, |FALSE| otherwise.
--- If the {buf} argument is a number, buffer numbers are used.
--- Number zero is the alternate buffer for the current window.
---
@@ -532,8 +532,9 @@ function vim.fn.buffer_name(...) end
--- @return integer
function vim.fn.buffer_number(...) end
--- The result is a Number, which is |TRUE| if a buffer called
--- {buf} exists and is listed (has the 'buflisted' option set).
--- Checks whether a buffer called {buf} exists and is listed
--- (has the 'buflisted' option set). Returns |TRUE| if so,
--- |FALSE| otherwise.
--- The {buf} argument is used like with |bufexists()|.
---
--- @param buf any
@@ -552,8 +553,9 @@ function vim.fn.buflisted(buf) end
--- @param buf any
function vim.fn.bufload(buf) end
--- The result is a Number, which is |TRUE| if a buffer called
--- {buf} exists and is loaded (shown in a window or hidden).
--- Checks whether a buffer called {buf} exists and is loaded
--- (shown in a window or hidden). Returns |TRUE| if so,
--- |FALSE| otherwise.
--- The {buf} argument is used like with |bufexists()|.
---
--- @param buf any
@@ -616,10 +618,10 @@ function vim.fn.bufname(buf) end
--- @return integer
function vim.fn.bufnr(buf, create) end
--- The result is a Number, which is the |window-ID| of the first
--- window associated with buffer {buf}. For the use of {buf},
--- see |bufname()| above. If buffer {buf} doesn't exist or
--- there is no such window, -1 is returned. Example: >vim
--- Returns the |window-ID| of the first window associated with
--- buffer {buf}. For the use of {buf}, see |bufname()| above.
--- If buffer {buf} doesn't exist or there is no such window, -1
--- is returned. Example: >vim
---
--- echo "A window containing buffer 1 is " .. (bufwinid(1))
--- <
@@ -955,8 +957,8 @@ function vim.fn.clearmatches(win) end
--- @return table<string,any>
function vim.fn.cmdcomplete_info() end
--- The result is a Number, which is the byte index of the column
--- position given with {expr}.
--- Returns the byte index of the column position given with
--- {expr}.
--- For accepted positions see |getpos()|.
--- When {expr} is "$", it means the end of the cursor line, so
--- the result is the number of bytes in the cursor line plus one.
@@ -1713,8 +1715,8 @@ function vim.fn.execute(command, silent) end
--- @return string
function vim.fn.exepath(expr) end
--- The result is a Number, which is |TRUE| if {expr} is
--- defined, zero otherwise.
--- Checks whether the expression {expr} is defined.
--- Returns |TRUE| if {expr} is defined, zero otherwise.
---
--- For checking for a supported feature use |has()|.
--- For checking if a file exists use |filereadable()|.
@@ -2075,12 +2077,12 @@ function vim.fn.file_readable(file) end
--- @return 0|1
function vim.fn.filecopy(from, to) end
--- The result is a Number, which is |TRUE| when a file with the
--- name {file} exists, and can be read. If {file} doesn't exist,
--- or is a directory, the result is |FALSE|. {file} is any
--- expression, which is used as a String.
--- If you don't care about the file being readable you can use
--- |glob()|.
--- Returns |TRUE| if {file} exists, can be read, and is not
--- a directory, else |FALSE|.
---
--- {file} is any expression, which is used as a String. If you
--- don't care about the file being readable you can use |glob()|.
---
--- {file} is used as-is, you may want to expand wildcards first: >vim
--- echo filereadable('~/.vimrc')
--- < >
@@ -2095,9 +2097,9 @@ function vim.fn.filecopy(from, to) end
--- @return 0|1
function vim.fn.filereadable(file) end
--- The result is a Number, which is 1 when a file with the
--- name {file} exists, and can be written. If {file} doesn't
--- exist, or is not writable, the result is 0. If {file} is a
--- Checks whether a file with the name {file} exists and can
--- be written. Returns 1 if so. If {file} doesn't exist, or
--- is not writable, the result is 0. If {file} is a
--- directory, and we can write to it, the result is 2.
---
--- @param file string
@@ -2330,9 +2332,9 @@ function vim.fn.fnameescape(string) end
--- @return string
function vim.fn.fnamemodify(fname, mods) end
--- The result is a Number. If the line {lnum} is in a closed
--- fold, the result is the number of the first line in that fold.
--- If the line {lnum} is not in a closed fold, -1 is returned.
--- Returns the first line number of the closed fold containing
--- line {lnum}. If the line {lnum} is not in a closed fold,
--- -1 is returned.
--- {lnum} is used like with |getline()|. Thus "." is the current
--- line, "'m" mark m, etc.
---
@@ -2340,9 +2342,9 @@ function vim.fn.fnamemodify(fname, mods) end
--- @return integer
function vim.fn.foldclosed(lnum) end
--- The result is a Number. If the line {lnum} is in a closed
--- fold, the result is the number of the last line in that fold.
--- If the line {lnum} is not in a closed fold, -1 is returned.
--- Returns the last line number of the closed fold containing
--- line {lnum}. If the line {lnum} is not in a closed fold,
--- -1 is returned.
--- {lnum} is used like with |getline()|. Thus "." is the current
--- line, "'m" mark m, etc.
---
@@ -2350,16 +2352,17 @@ function vim.fn.foldclosed(lnum) end
--- @return integer
function vim.fn.foldclosedend(lnum) end
--- The result is a Number, which is the foldlevel of line {lnum}
--- in the current buffer. For nested folds the deepest level is
--- returned. If there is no fold at line {lnum}, zero is
--- returned. It doesn't matter if the folds are open or closed.
--- When used while updating folds (from 'foldexpr') -1 is
--- returned for lines where folds are still to be updated and the
--- foldlevel is unknown. As a special case the level of the
--- previous line is usually available.
--- {lnum} is used like with |getline()|. Thus "." is the current
--- line, "'m" mark m, etc.
--- Returns the fold nesting level of line {lnum} in the current
--- buffer. {lnum} is used like with |getline()| ("." is the
--- current line, "'m" mark m, etc).
---
--- For nested folds the deepest level is returned. If there is
--- no fold at line {lnum}, zero is returned. It doesn't matter
--- if the folds are open or closed. When used while updating
--- folds (from 'foldexpr') -1 is returned for lines where folds
--- are still to be updated and the foldlevel is unknown. As
--- a special case the level of the previous line is usually
--- available.
---
--- @param lnum integer|string
--- @return integer
@@ -2901,8 +2904,8 @@ function vim.fn.getchangelist(buf) end
--- @return integer|string
function vim.fn.getchar(expr, opts) end
--- The result is a Number which is the state of the modifiers for
--- the last obtained character with |getchar()| or in another way.
--- Returns the state of the keyboard modifiers for the last
--- character obtained with |getchar()| or in another way.
--- These values are added together:
--- 2 shift
--- 4 control
@@ -3239,10 +3242,9 @@ function vim.fn.getenv(name) end
--- @return string
function vim.fn.getfontname(name) end
--- The result is a String, which is the read, write, and execute
--- permissions of the given file {fname}.
--- If {fname} does not exist or its directory cannot be read, an
--- empty string is returned.
--- Returns the file permissions of the given file {fname} as a
--- String. If {fname} does not exist or its directory cannot be
--- read, an empty string is returned.
--- The result is of the form "rwxrwxrwx", where each group of
--- "rwx" flags represent, in turn, the permissions of the owner
--- of the file, the group the file belongs to, and other users.
@@ -3259,8 +3261,7 @@ function vim.fn.getfontname(name) end
--- @return string
function vim.fn.getfperm(fname) end
--- The result is a Number, which is the size in bytes of the
--- given file {fname}.
--- Returns the size in bytes of the given file {fname}.
--- If {fname} is a directory, 0 is returned.
--- If the file {fname} can't be found, -1 is returned.
--- If the size of {fname} is too big to fit in a Number then -2
@@ -3270,9 +3271,9 @@ function vim.fn.getfperm(fname) end
--- @return integer
function vim.fn.getfsize(fname) end
--- The result is a Number, which is the last modification time of
--- the given file {fname}. The value is measured as seconds
--- since 1st Jan 1970, and may be passed to |strftime()|. See also
--- Returns the last modification time of the given file {fname}.
--- The value is measured as seconds since 1st Jan 1970, and may
--- be passed to |strftime()|. See also
--- |localtime()| and |strftime()|.
--- If the file {fname} can't be found -1 is returned.
---
@@ -3280,9 +3281,9 @@ function vim.fn.getfsize(fname) end
--- @return integer
function vim.fn.getftime(fname) end
--- The result is a String, which is a description of the kind of
--- file of the given file {fname}.
--- If {fname} does not exist an empty string is returned.
--- Returns a description of the type of file {fname} as a
--- String. If {fname} does not exist an empty string is
--- returned.
--- Here is a table over different kinds of files and their
--- results:
--- Normal file "file"
@@ -3665,8 +3666,8 @@ function vim.fn.getpos(expr) end
--- @return any
function vim.fn.getqflist(what) end
--- The result is a String, which is the contents of register
--- {regname}. Example: >vim
--- Returns the contents of register {regname} as a String.
--- Example: >vim
--- let cliptext = getreg('*')
--- <When register {regname} was not set the result is an empty
--- string.
@@ -3829,7 +3830,7 @@ function vim.fn.getregion(pos1, pos2, opts) end
--- @return [ [integer, integer, integer, integer], [integer, integer, integer, integer] ][]
function vim.fn.getregionpos(pos1, pos2, opts) end
--- The result is a String, which is type of register {regname}.
--- Returns the type of register {regname} as a String.
--- The value will be one of:
--- "v" for |charwise| text
--- "V" for |linewise| text
@@ -3961,7 +3962,7 @@ function vim.fn.gettabvar(tabnr, varname, def) end
--- @return any
function vim.fn.gettabwinvar(tabnr, winnr, varname, def) end
--- The result is a Dict, which is the tag stack of window {winnr}.
--- Returns the tag stack of window {winnr} as a Dict.
--- {winnr} can be the window number or the |window-ID|.
--- When {winnr} is not specified, the current window is used.
--- When window {winnr} doesn't exist, an empty Dict is returned.
@@ -4046,11 +4047,12 @@ function vim.fn.gettext(text) end
--- @return vim.fn.getwininfo.ret.item[]
function vim.fn.getwininfo(winid) end
--- The result is a |List| with two numbers, the result of
--- |getwinposx()| and |getwinposy()| combined:
--- [x-pos, y-pos]
--- Returns the [x, y] screen position of the Nvim GUI window as
--- a |List| with two numbers (result of |getwinposx()| and
--- |getwinposy()| combined).
---
--- {timeout} can be used to specify how long to wait in msec for
--- a response from the terminal. When omitted 100 msec is used.
--- a response. When omitted 100 msec is used.
---
--- Use a longer time for a remote terminal.
--- When using a value less than 10 and no response is received
@@ -4070,18 +4072,16 @@ function vim.fn.getwininfo(winid) end
--- @return any
function vim.fn.getwinpos(timeout) end
--- 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
--- -1 if the information is not available.
--- The value can be used with `:winpos`.
--- Returns the X coordinate in pixels of the left hand side of
--- the Nvim GUI window, or -1 if not available. The value can be
--- used with `:winpos`.
---
--- @return integer
function vim.fn.getwinposx() end
--- The result is a Number, which is the Y coordinate in pixels of
--- the top of the GUI Vim window. The result will be -1 if the
--- information is not available.
--- The value can be used with `:winpos`.
--- Returns the Y coordinate in pixels of the top of the Nvim GUI
--- window, or -1 if not available. The value can be used with
--- `:winpos`.
---
--- @return integer
function vim.fn.getwinposy() end
@@ -4273,8 +4273,8 @@ function vim.fn.globpath(path, expr, nosuf, list, allinks) end
--- @return 0|1
function vim.fn.has(feature) end
--- The result is a Number, which is TRUE if |Dictionary| {dict}
--- has an entry with key {key}. FALSE otherwise. The {key}
--- Checks whether |Dictionary| {dict} has an entry with key
--- {key}. Returns TRUE if so, FALSE otherwise. The {key}
--- argument is a string.
---
--- @param dict table
@@ -4282,9 +4282,10 @@ function vim.fn.has(feature) end
--- @return 0|1
function vim.fn.has_key(dict, key) end
--- The result is a Number, which is 1 when the window has set a
--- local path via |:lcd| or when {winnr} is -1 and the tabpage
--- has set a local path via |:tcd|, otherwise 0.
--- Checks whether the window or tabpage has set a local working
--- directory. Returns 1 when the window has set a local path
--- via |:lcd| or when {winnr} is -1 and the tabpage has set a
--- local path via |:tcd|, otherwise 0.
---
--- Tabs and windows are identified by their respective numbers,
--- 0 means current tab or window. Missing argument implies 0.
@@ -4303,9 +4304,8 @@ function vim.fn.has_key(dict, key) end
--- @return 0|1
function vim.fn.haslocaldir(winnr, tabnr) end
--- The result is a Number, which is TRUE if there is a mapping
--- that contains {what} in somewhere in the rhs (what it is
--- mapped to) and this mapping exists in one of the modes
--- Checks whether a mapping exists whose rhs contains {what}.
--- Returns TRUE if there is such a mapping in one of the modes
--- indicated by {mode}.
--- The arguments {what} and {mode} are strings.
--- When {abbr} is there and it is |TRUE| use abbreviations
@@ -4415,9 +4415,9 @@ function vim.fn.histadd(history, item) end
--- @return 0|1
function vim.fn.histdel(history, item) end
--- The result is a String, the entry with Number {index} from
--- {history}. See |hist-names| for the possible values of
--- {history}, and |:history-indexing| for {index}. If there is
--- Returns an entry from the specified command-line {history}.
--- See |hist-names| for the possible values of {history}, and
--- |:history-indexing| for {index}. If there is
--- no such entry, an empty String is returned. When {index} is
--- omitted, the most recent item from the history is used.
---
@@ -4447,9 +4447,9 @@ function vim.fn.histget(history, index) end
--- @return integer
function vim.fn.histnr(history) end
--- The result is a Number, which is the ID of the highlight group
--- with name {name}. When the highlight group doesn't exist,
--- zero is returned.
--- Returns the numeric ID of the highlight group with name
--- {name}. When the highlight group doesn't exist, zero is
--- returned.
--- This can be used to retrieve information about the highlight
--- group. For example, to get the background color of the
--- "Comment" group: >vim
@@ -4460,25 +4460,24 @@ function vim.fn.histnr(history) end
--- @return integer
function vim.fn.hlID(name) end
--- The result is a Number, which is TRUE if a highlight group
--- called {name} exists. This is when the group has been
--- defined in some way. Not necessarily when highlighting has
--- been defined for it, it may also have been used for a syntax
--- item.
--- Checks whether a highlight group called {name} exists.
--- Returns TRUE if the group has been defined in some way. Not
--- necessarily when highlighting has been defined for it, it may
--- also have been used for a syntax item.
---
--- @param name string
--- @return 0|1
function vim.fn.hlexists(name) end
--- The result is a String, which is the name of the machine on
--- which Vim is currently running. Machine names greater than
--- Returns the hostname of the machine on which the Nvim server
--- (not the UI client) is currently running. Names greater than
--- 256 characters long are truncated.
---
--- @return string
function vim.fn.hostname() end
--- The result is a String, which is the text {string} converted
--- from encoding {from} to encoding {to}.
--- Converts the encoding of {string} from {from} to {to}.
--- Returns the converted String.
--- When the conversion completely fails an empty string is
--- returned. When some characters could not be converted they
--- are replaced with "?".
@@ -4514,9 +4513,9 @@ function vim.fn.iconv(string, from, to) end
--- @return string
function vim.fn.id(expr) end
--- The result is a Number, which is indent of line {lnum} in the
--- current buffer. The indent is counted in spaces, the value
--- of 'tabstop' is relevant. {lnum} is used just like in
--- Returns the indent of line {lnum} in the current buffer.
--- The indent is counted in spaces, the value of 'tabstop' is
--- relevant. {lnum} is used just like in
--- |getline()|.
--- When {lnum} is invalid -1 is returned.
---
@@ -4611,10 +4610,10 @@ function vim.fn.indexof(object, expr, opts) end
--- @return string
function vim.fn.input(prompt, text, completion) end
--- The result is a String, which is whatever the user typed on
--- the command-line. The {prompt} argument is either a prompt
--- string, or a blank string (for no prompt). A '\n' can be used
--- in the prompt to start a new line.
--- Prompts the user to enter text on the command-line, and
--- returns the text as a String. The {prompt} argument is either
--- a prompt string, or a blank string (for no prompt). A '\n'
--- can be used in the prompt to start a new line.
---
--- In the second form it accepts a single dictionary with the
--- following keys, any of which may be omitted:
@@ -4732,9 +4731,9 @@ function vim.fn.input(opts) end
--- @return any
function vim.fn.inputdialog(...) end
--- {textlist} must be a |List| of strings. This |List| is
--- displayed, one string per line. The user will be prompted to
--- enter a number, which is returned.
--- Displays a list of strings and prompts the user to select
--- one by entering a number. {textlist} must be a |List| of
--- strings. Returns the number the user entered.
--- The user can also select an item by clicking on it with the
--- mouse, if the mouse is enabled in the command line ('mouse' is
--- "a" or includes "c"). For the first string 0 is returned.
@@ -4834,8 +4833,8 @@ function vim.fn.interrupt() end
--- @return integer
function vim.fn.invert(expr) end
--- The result is a Number, which is |TRUE| when {path} is an
--- absolute path.
--- Checks whether {path} is an absolute path. Returns |TRUE|
--- if so, |FALSE| otherwise.
--- On Unix, a path is considered absolute when it starts with
--- '/'.
--- On MS-Windows, it is considered absolute when it starts with
@@ -4853,10 +4852,9 @@ function vim.fn.invert(expr) end
--- @return 0|1
function vim.fn.isabsolutepath(path) end
--- The result is a Number, which is |TRUE| when a directory
--- with the name {directory} exists. If {directory} doesn't
--- exist, or isn't a directory, the result is |FALSE|. {directory}
--- is any expression, which is used as a String.
--- Returns |TRUE| if {directory} exists, or |FALSE| if it doesn't
--- exist or isn't a directory. {directory} is any expression,
--- which is used as a String.
---
--- @param directory string
--- @return 0|1
@@ -4873,8 +4871,8 @@ function vim.fn.isdirectory(directory) end
--- @return 1|0|-1
function vim.fn.isinf(expr) end
--- The result is a Number, which is |TRUE| when {expr} is the
--- name of a locked variable.
--- Returns |TRUE| if {expr} is the name of a locked variable,
--- else |FALSE|.
--- The string argument {expr} must be the name of a variable,
--- |List| item or |Dictionary| entry, not the variable itself!
--- Example: >vim
@@ -5157,7 +5155,7 @@ function vim.fn.keytrans(string) end
--- @return any
function vim.fn.last_buffer_nr() end
--- The result is a Number, which is the length of the argument.
--- Returns the length of the argument.
--- When {expr} is a String or a Number the length in bytes is
--- used, as with |strlen()|.
--- When {expr} is a |List| the number of items in the |List| is
@@ -7482,11 +7480,11 @@ function vim.fn.rubyeval(expr) end
--- @return integer
function vim.fn.screenattr(row, col) end
--- The result is a Number, which is the character at position
--- [row, col] on the screen. This works for every possible
--- screen position, also status lines, window separators and the
--- command line. The top left position is row one, column one
--- The character excludes composing characters. For double-byte
--- Returns the character at screen position [row, col] as a
--- Number. This works for every possible screen position, also
--- status lines, window separators and the command line. The
--- top left position is row one, column one. The character
--- excludes composing characters. For double-byte
--- encodings it may only be the first byte.
--- This is mainly to be used for testing.
--- Returns -1 when row or col is out of range.
@@ -7496,9 +7494,10 @@ function vim.fn.screenattr(row, col) end
--- @return integer
function vim.fn.screenchar(row, col) end
--- The result is a |List| of Numbers. The first number is the same
--- as what |screenchar()| returns. Further numbers are
--- composing characters on top of the base character.
--- Returns the character and any composing characters at screen
--- position [row, col] as a |List| of Numbers. The first number
--- is the same as what |screenchar()| returns; further numbers
--- are composing characters on top of the base character.
--- This is mainly to be used for testing.
--- Returns an empty List when row or col is out of range.
---
@@ -7507,8 +7506,8 @@ function vim.fn.screenchar(row, col) end
--- @return integer[]
function vim.fn.screenchars(row, col) end
--- The result is a Number, which is the current screen column of
--- the cursor. The leftmost column has number 1.
--- Returns the current screen column of the cursor. The
--- leftmost column has number 1.
--- This function is mainly used for testing.
---
--- Note: Always returns the current screen column, thus if used
@@ -7524,9 +7523,9 @@ function vim.fn.screenchars(row, col) end
--- @return integer
function vim.fn.screencol() end
--- The result is a Dict with the screen position of the text
--- character in window {winid} at buffer line {lnum} and column
--- {col}. {col} is a one-based byte index.
--- Returns the screen position of the text character in window
--- {winid} at buffer line {lnum} and column {col} as a Dict.
--- {col} is a one-based byte index.
--- The Dict has these members:
--- row screen row
--- col first screen column
@@ -7553,8 +7552,8 @@ function vim.fn.screencol() end
--- @return { col: integer, curscol: integer, endcol: integer, row: integer }
function vim.fn.screenpos(winid, lnum, col) end
--- The result is a Number, which is the current screen row of the
--- cursor. The top line has number one.
--- Returns the current screen row of the cursor. The top line
--- has number one.
--- This function is mainly used for testing.
--- Alternatively you can use |winline()|.
---
@@ -7563,10 +7562,9 @@ function vim.fn.screenpos(winid, lnum, col) end
--- @return integer
function vim.fn.screenrow() end
--- The result is a String that contains the base character and
--- any composing characters at position [row, col] on the screen.
--- This is like |screenchars()| but returning a String with the
--- characters.
--- Returns the base character and any composing characters at
--- screen position [row, col] as a String. This is like
--- |screenchars()| but returning a String with the characters.
--- This is mainly to be used for testing.
--- Returns an empty String when row or col is out of range.
---
@@ -9566,13 +9564,12 @@ function vim.fn.str2list(string, utf8) end
--- @return any
function vim.fn.str2nr(string, base) end
--- The result is a Number, which is the number of characters
--- in String {string}. Composing characters are ignored.
--- Returns the number of characters in String {string}, ignoring
--- composing characters. Returns 0 on error or empty {string}.
---
--- |strchars()| can count the number of characters, counting
--- composing characters separately.
---
--- Returns 0 if {string} is empty or on error.
---
--- Also see |strlen()|, |strdisplaywidth()| and |strwidth()|.
---
--- @param string string
@@ -9600,8 +9597,7 @@ function vim.fn.strcharlen(string) end
--- @return string
function vim.fn.strcharpart(src, start, len, skipcc) end
--- The result is a Number, which is the number of characters
--- in String {string}.
--- Returns the number of characters in String {string}.
--- When {skipcc} is omitted or zero, composing characters are
--- counted separately.
--- When {skipcc} set to 1, composing characters are ignored.
@@ -9633,18 +9629,20 @@ function vim.fn.strcharpart(src, start, len, skipcc) end
--- @return integer
function vim.fn.strchars(string, skipcc) end
--- The result is a Number, which is the number of display cells
--- String {string} occupies on the screen when it starts at {col}
--- (first column is zero). When {col} is omitted zero is used.
--- Otherwise it is the screen column where to start. This
--- matters for Tab characters.
--- Returns the number of display cells String {string} occupies
--- on the screen when it starts at {col} (first column is zero).
--- Returns zero on error.
---
--- When {col} is omitted zero is used. Otherwise it is the screen
--- column where to start. This matters for Tab characters.
--- The option settings of the current window are used. This
--- matters for anything that's displayed differently, such as
--- 'tabstop' and 'display'.
---
--- When {string} contains characters with East Asian Width Class
--- Ambiguous, this function's return value depends on
--- 'ambiwidth'.
--- Returns zero on error.
---
--- Also see |strlen()|, |strwidth()| and |strchars()|.
---
--- @param string string
@@ -9652,10 +9650,9 @@ function vim.fn.strchars(string, skipcc) end
--- @return integer
function vim.fn.strdisplaywidth(string, col) end
--- The result is a String, which is a formatted date and time, as
--- specified by the {format} string. The given {time} is used,
--- or the current time if no time is given. The accepted
--- {format} depends on your system, thus this is not portable!
--- Formats a date and time String specified by {format}. The
--- given {time} is used, or the current time if no time is given.
--- The {format} depends on your system, this is not portable!
--- See the manual page of the C function strftime() for the
--- format. The maximum length of the result is 80 characters.
--- See also |localtime()|, |getftime()| and |strptime()|.
@@ -9687,8 +9684,8 @@ function vim.fn.strftime(format, time) end
--- @return integer
function vim.fn.strgetchar(str, index) end
--- The result is a Number, which gives the byte index in
--- {haystack} of the first occurrence of the String {needle}.
--- Returns the byte index of the first occurrence of {needle}
--- in {haystack}.
--- If {start} is specified, the search starts at index {start}.
--- This can be used to find a second match: >vim
--- let colon1 = stridx(line, ":")
@@ -9711,9 +9708,10 @@ function vim.fn.strgetchar(str, index) end
--- @return integer
function vim.fn.stridx(haystack, needle, start) end
--- Return {expr} converted to a String. If {expr} is a Number,
--- Float, String, Blob or a composition of them, then the result
--- can be parsed back with |eval()|.
--- Converts {expr} to a String. If {expr} is a Number, Float,
--- String, Blob or a composition of them, the result can be
--- parsed back with |eval()|.
---
--- {expr} type result ~
--- String 'string'
--- Number 123
@@ -9723,14 +9721,16 @@ function vim.fn.stridx(haystack, needle, start) end
--- Blob 0z00112233.44556677.8899
--- List [item, item]
--- Dictionary `{key: value, key: value}`
--- Note that in String values the ' character is doubled.
---
--- Note: in String values the ' character is doubled.
--- Also see |strtrans()|.
--- Note 2: Output format is mostly compatible with YAML, except
--- for infinite and NaN floating-point values representations
--- which use |str2float()|. Strings are also dumped literally,
--- only single quote is escaped, which does not allow using YAML
--- for parsing back binary strings. |eval()| should always work
--- for strings and floats though, and this is the only official
---
--- Note: Output format is mostly compatible with YAML, except for
--- infinite and NaN floating-point values representations which
--- use |str2float()|. Strings are also dumped literally, only
--- single quote is escaped, which does not allow using YAML for
--- parsing back binary strings. |eval()| should always work for
--- strings and floats though, and this is the only official
--- method. Use |msgpackdump()| or |json_encode()| if you need to
--- share data with other applications.
---
@@ -9738,8 +9738,7 @@ function vim.fn.stridx(haystack, needle, start) end
--- @return string
function vim.fn.string(expr) end
--- The result is a Number, which is the length of the String
--- {string} in bytes.
--- Returns the length of String {string} in bytes.
--- If the argument is a Number it is first converted to a String.
--- For other types an error is given and zero is returned.
--- If you want to count the number of multibyte characters use
@@ -9750,12 +9749,14 @@ function vim.fn.string(expr) end
--- @return integer
function vim.fn.strlen(string) end
--- The result is a String, which is part of {src}, starting from
--- byte {start}, with the byte length {len}.
--- Gets a substring from {src}, starting from byte {start}, with
--- byte length {len}. Returns empty string on error.
---
--- When {chars} is present and TRUE then {len} is the number of
--- characters positions (composing characters are not counted
--- separately, thus "1" means one base character and any
--- following composing characters).
---
--- To count {start} as characters instead of bytes use
--- |strcharpart()|.
---
@@ -9772,7 +9773,6 @@ function vim.fn.strlen(string) end
--- example, to get the character under the cursor: >vim
--- strpart(getline("."), col(".") - 1, 1, v:true)
--- <
--- Returns an empty string on error.
---
--- @param src string
--- @param start integer
@@ -9781,14 +9781,12 @@ function vim.fn.strlen(string) end
--- @return string
function vim.fn.strpart(src, start, len, chars) end
--- The result is a Number, which is a unix timestamp representing
--- the date and time in {timestring}, which is expected to match
--- the format specified in {format}.
--- Parses a date/time string and returns a unix timestamp.
--- {timestring} must match the format specified in {format}.
---
--- The accepted {format} depends on your system, thus this is not
--- portable! See the manual page of the C function strptime()
--- for the format. Especially avoid "%c". The value of $TZ also
--- matters.
--- The {format} depends on your system, this is not portable!
--- See the strptime() manpage for the format. Especially avoid
--- "%c". The value of $TZ also matters.
---
--- If the {timestring} cannot be parsed with {format} zero is
--- returned. If you do not know the format of {timestring} you
@@ -9809,8 +9807,8 @@ function vim.fn.strpart(src, start, len, chars) end
--- @return integer
function vim.fn.strptime(format, timestring) end
--- The result is a Number, which gives the byte index in
--- {haystack} of the last occurrence of the String {needle}.
--- Returns the byte index of the last occurrence of {needle}
--- in {haystack}.
--- When {start} is specified, matches beyond this index are
--- ignored. This can be used to find a match before a previous
--- match: >vim
@@ -9832,9 +9830,9 @@ function vim.fn.strptime(format, timestring) end
--- @return integer
function vim.fn.strridx(haystack, needle, start) end
--- The result is a String, which is {string} with all unprintable
--- characters translated into printable characters 'isprint'.
--- Like they are shown in a window. Example: >vim
--- Translates all unprintable characters in {string} into
--- printable characters 'isprint', like they are shown in a
--- window. Example: >vim
--- echo strtrans(\@a)
--- <This displays a newline in register a as "^\@" instead of
--- starting a new line.
@@ -9845,8 +9843,8 @@ function vim.fn.strridx(haystack, needle, start) end
--- @return string
function vim.fn.strtrans(string) end
--- The result is a Number, which is the number of UTF-16 code
--- units in String {string} (after converting it to UTF-16).
--- Returns the number of UTF-16 code units in String {string}
--- (after converting it to UTF-16).
---
--- When {countcc} is TRUE, composing characters are counted
--- separately.
@@ -9869,9 +9867,9 @@ function vim.fn.strtrans(string) end
--- @return integer
function vim.fn.strutf16len(string, countcc) end
--- The result is a Number, which is the number of display cells
--- String {string} occupies. A Tab character is counted as one
--- cell, alternatively use |strdisplaywidth()|.
--- Returns the number of display cells String {string} occupies.
--- A Tab character is counted as one cell, alternatively use
--- |strdisplaywidth()|.
--- When {string} contains characters with East Asian Width Class
--- Ambiguous, this function's return value depends on
--- 'ambiwidth'.
@@ -9919,8 +9917,8 @@ function vim.fn.submatch(nr, list) end
--- @return string|string[]
function vim.fn.submatch(nr, list) end
--- The result is a String, which is a copy of {string}, in which
--- the first match of {pat} is replaced with {sub}.
--- Performs string substitution. Returns a copy of {string}
--- in which the first match of {pat} is replaced with {sub}.
--- When {flags} is "g", all matches of {pat} in {string} are
--- replaced. Otherwise {flags} should be "".
---
@@ -9982,8 +9980,8 @@ function vim.fn.substitute(string, pat, sub, flags) end
--- @return string[]
function vim.fn.swapfilelist() end
--- The result is a dictionary, which holds information about the
--- swapfile {fname}. The available fields are:
--- Returns information about the swapfile {fname} as a
--- dictionary. The available fields are:
--- version Vim version
--- user user name
--- host host name
@@ -10013,10 +10011,9 @@ function vim.fn.swapinfo(fname) end
--- @return string
function vim.fn.swapname(buf) end
--- The result is a Number, which is the syntax ID at the position
--- {lnum} and {col} in the current window.
--- The syntax ID can be used with |synIDattr()| and
--- |synIDtrans()| to obtain syntax information about text.
--- Returns the syntax ID at position {lnum} and {col} in the
--- current window. The syntax ID can be used with |synIDattr()|
--- and |synIDtrans()| to obtain syntax information about text.
---
--- {col} is 1 for the leftmost column, {lnum} is 1 for the first
--- line. 'synmaxcol' applies, in a longer line zero is returned.
@@ -10044,9 +10041,9 @@ function vim.fn.swapname(buf) end
--- @return integer
function vim.fn.synID(lnum, col, trans) end
--- The result is a String, which is the {what} attribute of
--- syntax ID {synID}. This can be used to obtain information
--- about a syntax item.
--- Returns the {what} attribute of syntax ID {synID} as a
--- String. This can be used to obtain information about a
--- syntax item.
--- {mode} can be "gui" or "cterm", to get the attributes
--- for that mode. When {mode} is omitted, or an invalid value is
--- used, the attributes for the currently active highlighting are
@@ -10099,9 +10096,9 @@ function vim.fn.synID(lnum, col, trans) end
--- @return string
function vim.fn.synIDattr(synID, what, mode) end
--- The result is a Number, which is the translated syntax ID of
--- {synID}. This is the syntax group ID of what is being used to
--- highlight the character. Highlight links given with
--- Returns the translated syntax ID of {synID}, following
--- highlight links. This is the syntax group ID of what is
--- being used to highlight the character. Highlight links given with
--- ":highlight link" are followed.
---
--- Returns zero on error.
@@ -10110,10 +10107,11 @@ function vim.fn.synIDattr(synID, what, mode) end
--- @return integer
function vim.fn.synIDtrans(synID) end
--- The result is a |List| with three items:
--- 1. The first item in the list is 0 if the character at the
--- position {lnum} and {col} is not part of a concealable
--- region, 1 if it is. {lnum} is used like with |getline()|.
--- Returns conceal information for the character at position
--- {lnum} and {col} as a |List| with three items:
--- 1. The first item in the list is 0 if the character is not
--- part of a concealable region, 1 if it is. {lnum} is used
--- like with |getline()|.
--- 2. The second item in the list is a string. If the first item
--- is 1, the second item contains the text which will be
--- displayed in place of the concealed text, depending on the
@@ -10238,8 +10236,8 @@ function vim.fn.system(cmd, input) end
--- @return string[]
function vim.fn.systemlist(cmd, input, keepempty) end
--- The result is a |List|, where each item is the number of the
--- buffer associated with each window in the current tab page.
--- Returns a |List| of buffer numbers, one for each window in
--- the specified tab page.
--- {arg} specifies the number of the tab page to be used. When
--- omitted the current tab page is used.
--- When {arg} is invalid the number zero is returned.
@@ -10254,8 +10252,8 @@ function vim.fn.systemlist(cmd, input, keepempty) end
--- @return any
function vim.fn.tabpagebuflist(arg) end
--- The result is a Number, which is the number of the current
--- tab page. The first tab page has number 1.
--- Returns the number of the current tab page. The first tab
--- page has number 1.
---
--- The optional argument {arg} supports the following values:
--- $ the number of the last tab page (the tab page
@@ -10472,27 +10470,23 @@ function vim.fn.timer_stop(timer) end
--- @return any
function vim.fn.timer_stopall() end
--- The result is a copy of the String given, with all uppercase
--- characters turned into lowercase (just like applying |gu| to
--- the string). Returns an empty string on error.
--- Converts a String to lowercase (like applying |gu|).
--- Returns empty string on error.
---
--- @param expr string
--- @return string
function vim.fn.tolower(expr) end
--- The result is a copy of the String given, with all lowercase
--- characters turned into uppercase (just like applying |gU| to
--- the string). Returns an empty string on error.
--- Converts a String to uppercase (like applying |gU|).
--- Returns empty string on error.
---
--- @param expr string
--- @return string
function vim.fn.toupper(expr) end
--- The result is a copy of the {src} string with all characters
--- which appear in {fromstr} replaced by the character in that
--- position in the {tostr} string. Thus the first character in
--- {fromstr} is translated into the first character in {tostr}
--- and so on. Exactly like the unix "tr" command.
--- Translates characters in {src}, replacing each character that
--- appears in {fromstr} with the corresponding character in
--- {tostr}. Exactly like the unix "tr" command.
--- This code also deals with multibyte characters properly.
---
--- Returns an empty string on error.
@@ -10558,7 +10552,7 @@ function vim.fn.trim(text, mask, dir) end
--- @return integer
function vim.fn.trunc(expr) end
--- The result is a Number representing the type of {expr}.
--- Returns the type of {expr} as a Number.
--- Instead of using the number directly, it is better to use the
--- v:t_ variable that has the value:
--- Number: 0 |v:t_number|
@@ -10711,10 +10705,10 @@ function vim.fn.utf16idx(string, idx, countcc, charidx) end
--- @return any
function vim.fn.values(dict) end
--- The result is a Number, which is the screen column of the file
--- position given with {expr}. That is, the total number of
--- screen cells occupied by the part of the line until the end of
--- the character at that position. When there is a <Tab> at the
--- Returns the virtual (screen) column of the file position
--- given with {expr}. That is, the total number of screen cells
--- occupied by the part of the line until the end of the
--- character at that position. When there is a <Tab> at the
--- position, the returned Number will be the column at the end of
--- the <Tab>. For example, for a <Tab> in column 1, with 'ts'
--- set to 8, it returns 8. |conceal| is ignored.
@@ -10764,9 +10758,9 @@ function vim.fn.values(dict) end
--- @return integer|[integer, integer]
function vim.fn.virtcol(expr, list, winid) end
--- The result is a Number, which is the byte index of the
--- character in window {winid} at buffer line {lnum} and virtual
--- column {col}.
--- Converts a virtual column to a byte index. Returns the byte
--- index of the character in window {winid} at buffer line
--- {lnum} and virtual column {col}.
---
--- If buffer line {lnum} is an empty line, 0 is returned.
---
@@ -10791,9 +10785,9 @@ function vim.fn.virtcol(expr, list, winid) end
--- @return integer
function vim.fn.virtcol2col(winid, lnum, col) end
--- 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",
--- Returns a String describing 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",
--- "V", or "<CTRL-V>" (a single CTRL-V character) for
--- character-wise, line-wise, or block-wise Visual mode
--- respectively.
@@ -11024,9 +11018,8 @@ function vim.fn.win_screenpos(nr) end
--- @return any
function vim.fn.win_splitmove(nr, target, options) end
--- The result is a Number, which is the number of the buffer
--- associated with window {nr}. {nr} can be the window number or
--- the |window-ID|.
--- Returns the buffer number associated with window {nr}.
--- {nr} can be the window number or the |window-ID|.
--- When {nr} is zero, the number of the buffer in the current
--- window is returned.
--- When window {nr} doesn't exist, -1 is returned.
@@ -11038,17 +11031,18 @@ function vim.fn.win_splitmove(nr, target, options) end
--- @return integer
function vim.fn.winbufnr(nr) end
--- The result is a Number, which is the virtual column of the
--- cursor in the window. This is counting screen cells from the
--- left side of the window. The leftmost column is one.
--- Returns the virtual column of the cursor in the window.
--- This is counting screen cells from the left side of the
--- window. The leftmost column is one.
---
--- @return integer
function vim.fn.wincol() end
--- The result is a String. For MS-Windows it indicates the OS
--- version. E.g, Windows 10 is "10.0", Windows 8 is "6.2",
--- Windows XP is "5.1". For non-MS-Windows systems the result is
--- an empty string.
--- Returns the Windows OS version as a String. E.g, Windows 10
--- is "10.0", Windows 8 is "6.2", Windows XP is "5.1". For
--- non-MS-Windows systems the result is an empty string.
---
--- See also Lua |uv.os_uname()|.
---
--- @return string
function vim.fn.windowsversion() end
@@ -11066,8 +11060,7 @@ function vim.fn.windowsversion() end
--- @return integer
function vim.fn.winheight(nr) end
--- The result is a nested List containing the layout of windows
--- in a tabpage.
--- Returns the layout of windows in a tabpage as a nested List.
---
--- Without {tabnr} use the current tabpage, otherwise the tabpage
--- with number {tabnr}. If the tabpage {tabnr} is not found,
@@ -11106,19 +11099,18 @@ function vim.fn.winheight(nr) end
--- @return vim.fn.winlayout.ret
function vim.fn.winlayout(tabnr) end
--- The result is a Number, which is the screen line of the cursor
--- in the window. This is counting screen lines from the top of
--- the window. The first line is one.
--- Returns the screen line of the cursor in the window. This is
--- counting screen lines from the top of the window. The first
--- line is one.
--- If the cursor was moved the view on the file will be updated
--- first, this may cause a scroll.
---
--- @return integer
function vim.fn.winline() end
--- The result is a Number, which is the number of the current
--- window. The top window has number 1.
--- Returns zero for a hidden or non |focusable| window, unless
--- it is the current window.
--- Returns the number of the current window. The top window has
--- number 1. Returns zero for a hidden or non |focusable|
--- window, unless it is the current window.
---
--- The optional argument {arg} supports the following values:
--- $ the number of the last window (the window
@@ -11233,9 +11225,8 @@ function vim.fn.winsaveview() end
--- @return integer
function vim.fn.winwidth(nr) end
--- The result is a dictionary of byte/chars/word statistics for
--- the current buffer. This is the same info as provided by
--- |g_CTRL-G|
--- Returns a dictionary of byte/chars/word statistics for the
--- current buffer. This is the same info provided by |g_CTRL-G|.
--- The return value includes:
--- bytes Number of bytes in the buffer
--- chars Number of chars in the buffer

View File

@@ -679,8 +679,8 @@ M.funcs = {
args = 1,
base = 1,
desc = [=[
The result is a Number, which is |TRUE| if a buffer called
{buf} exists.
Checks whether a buffer with the name or number {buf} exists.
Returns |TRUE| if the buffer exists, |FALSE| otherwise.
If the {buf} argument is a number, buffer numbers are used.
Number zero is the alternate buffer for the current window.
@@ -749,8 +749,9 @@ M.funcs = {
args = 1,
base = 1,
desc = [=[
The result is a Number, which is |TRUE| if a buffer called
{buf} exists and is listed (has the 'buflisted' option set).
Checks whether a buffer called {buf} exists and is listed
(has the 'buflisted' option set). Returns |TRUE| if so,
|FALSE| otherwise.
The {buf} argument is used like with |bufexists()|.
]=],
@@ -782,8 +783,9 @@ M.funcs = {
args = 1,
base = 1,
desc = [=[
The result is a Number, which is |TRUE| if a buffer called
{buf} exists and is loaded (shown in a window or hidden).
Checks whether a buffer called {buf} exists and is loaded
(shown in a window or hidden). Returns |TRUE| if so,
|FALSE| otherwise.
The {buf} argument is used like with |bufexists()|.
]=],
@@ -862,10 +864,10 @@ M.funcs = {
args = 1,
base = 1,
desc = [=[
The result is a Number, which is the |window-ID| of the first
window associated with buffer {buf}. For the use of {buf},
see |bufname()| above. If buffer {buf} doesn't exist or
there is no such window, -1 is returned. Example: >vim
Returns the |window-ID| of the first window associated with
buffer {buf}. For the use of {buf}, see |bufname()| above.
If buffer {buf} doesn't exist or there is no such window, -1
is returned. Example: >vim
echo "A window containing buffer 1 is " .. (bufwinid(1))
<
@@ -1296,8 +1298,8 @@ M.funcs = {
args = { 1, 2 },
base = 1,
desc = [=[
The result is a Number, which is the byte index of the column
position given with {expr}.
Returns the byte index of the column position given with
{expr}.
For accepted positions see |getpos()|.
When {expr} is "$", it means the end of the cursor line, so
the result is the number of bytes in the cursor line plus one.
@@ -2244,8 +2246,8 @@ M.funcs = {
args = 1,
base = 1,
desc = [=[
The result is a Number, which is |TRUE| if {expr} is
defined, zero otherwise.
Checks whether the expression {expr} is defined.
Returns |TRUE| if {expr} is defined, zero otherwise.
For checking for a supported feature use |has()|.
For checking if a file exists use |filereadable()|.
@@ -2648,12 +2650,12 @@ M.funcs = {
args = 1,
base = 1,
desc = [=[
The result is a Number, which is |TRUE| when a file with the
name {file} exists, and can be read. If {file} doesn't exist,
or is a directory, the result is |FALSE|. {file} is any
expression, which is used as a String.
If you don't care about the file being readable you can use
|glob()|.
Returns |TRUE| if {file} exists, can be read, and is not
a directory, else |FALSE|.
{file} is any expression, which is used as a String. If you
don't care about the file being readable you can use |glob()|.
{file} is used as-is, you may want to expand wildcards first: >vim
echo filereadable('~/.vimrc')
< >
@@ -2675,9 +2677,9 @@ M.funcs = {
args = 1,
base = 1,
desc = [=[
The result is a Number, which is 1 when a file with the
name {file} exists, and can be written. If {file} doesn't
exist, or is not writable, the result is 0. If {file} is a
Checks whether a file with the name {file} exists and can
be written. Returns 1 if so. If {file} doesn't exist, or
is not writable, the result is 0. If {file} is a
directory, and we can write to it, the result is 2.
]=],
@@ -2965,9 +2967,9 @@ M.funcs = {
args = 1,
base = 1,
desc = [=[
The result is a Number. If the line {lnum} is in a closed
fold, the result is the number of the first line in that fold.
If the line {lnum} is not in a closed fold, -1 is returned.
Returns the first line number of the closed fold containing
line {lnum}. If the line {lnum} is not in a closed fold,
-1 is returned.
{lnum} is used like with |getline()|. Thus "." is the current
line, "'m" mark m, etc.
@@ -2981,9 +2983,9 @@ M.funcs = {
args = 1,
base = 1,
desc = [=[
The result is a Number. If the line {lnum} is in a closed
fold, the result is the number of the last line in that fold.
If the line {lnum} is not in a closed fold, -1 is returned.
Returns the last line number of the closed fold containing
line {lnum}. If the line {lnum} is not in a closed fold,
-1 is returned.
{lnum} is used like with |getline()|. Thus "." is the current
line, "'m" mark m, etc.
@@ -2997,17 +2999,17 @@ M.funcs = {
args = 1,
base = 1,
desc = [=[
The result is a Number, which is the foldlevel of line {lnum}
in the current buffer. For nested folds the deepest level is
returned. If there is no fold at line {lnum}, zero is
returned. It doesn't matter if the folds are open or closed.
When used while updating folds (from 'foldexpr') -1 is
returned for lines where folds are still to be updated and the
foldlevel is unknown. As a special case the level of the
previous line is usually available.
{lnum} is used like with |getline()|. Thus "." is the current
line, "'m" mark m, etc.
Returns the fold nesting level of line {lnum} in the current
buffer. {lnum} is used like with |getline()| ("." is the
current line, "'m" mark m, etc).
For nested folds the deepest level is returned. If there is
no fold at line {lnum}, zero is returned. It doesn't matter
if the folds are open or closed. When used while updating
folds (from 'foldexpr') -1 is returned for lines where folds
are still to be updated and the foldlevel is unknown. As
a special case the level of the previous line is usually
available.
]=],
name = 'foldlevel',
params = { { 'lnum', 'integer|string' } },
@@ -3632,8 +3634,8 @@ M.funcs = {
},
getcharmod = {
desc = [=[
The result is a Number which is the state of the modifiers for
the last obtained character with |getchar()| or in another way.
Returns the state of the keyboard modifiers for the last
character obtained with |getchar()| or in another way.
These values are added together:
2 shift
4 control
@@ -4054,10 +4056,9 @@ M.funcs = {
args = 1,
base = 1,
desc = [=[
The result is a String, which is the read, write, and execute
permissions of the given file {fname}.
If {fname} does not exist or its directory cannot be read, an
empty string is returned.
Returns the file permissions of the given file {fname} as a
String. If {fname} does not exist or its directory cannot be
read, an empty string is returned.
The result is of the form "rwxrwxrwx", where each group of
"rwx" flags represent, in turn, the permissions of the owner
of the file, the group the file belongs to, and other users.
@@ -4080,8 +4081,7 @@ M.funcs = {
args = 1,
base = 1,
desc = [=[
The result is a Number, which is the size in bytes of the
given file {fname}.
Returns the size in bytes of the given file {fname}.
If {fname} is a directory, 0 is returned.
If the file {fname} can't be found, -1 is returned.
If the size of {fname} is too big to fit in a Number then -2
@@ -4098,9 +4098,9 @@ M.funcs = {
args = 1,
base = 1,
desc = [=[
The result is a Number, which is the last modification time of
the given file {fname}. The value is measured as seconds
since 1st Jan 1970, and may be passed to |strftime()|. See also
Returns the last modification time of the given file {fname}.
The value is measured as seconds since 1st Jan 1970, and may
be passed to |strftime()|. See also
|localtime()| and |strftime()|.
If the file {fname} can't be found -1 is returned.
@@ -4115,9 +4115,9 @@ M.funcs = {
args = 1,
base = 1,
desc = [=[
The result is a String, which is a description of the kind of
file of the given file {fname}.
If {fname} does not exist an empty string is returned.
Returns a description of the type of file {fname} as a
String. If {fname} does not exist an empty string is
returned.
Here is a table over different kinds of files and their
results:
Normal file "file"
@@ -4548,8 +4548,8 @@ M.funcs = {
args = { 0, 3 },
base = 1,
desc = [=[
The result is a String, which is the contents of register
{regname}. Example: >vim
Returns the contents of register {regname} as a String.
Example: >vim
let cliptext = getreg('*')
<When register {regname} was not set the result is an empty
string.
@@ -4737,7 +4737,7 @@ M.funcs = {
args = { 0, 1 },
base = 1,
desc = [=[
The result is a String, which is type of register {regname}.
Returns the type of register {regname} as a String.
The value will be one of:
"v" for |charwise| text
"V" for |linewise| text
@@ -4898,7 +4898,7 @@ M.funcs = {
args = { 0, 1 },
base = 1,
desc = [=[
The result is a Dict, which is the tag stack of window {winnr}.
Returns the tag stack of window {winnr} as a Dict.
{winnr} can be the window number or the |window-ID|.
When {winnr} is not specified, the current window is used.
When window {winnr} doesn't exist, an empty Dict is returned.
@@ -4999,11 +4999,12 @@ M.funcs = {
args = { 0, 1 },
base = 1,
desc = [=[
The result is a |List| with two numbers, the result of
|getwinposx()| and |getwinposy()| combined:
[x-pos, y-pos]
Returns the [x, y] screen position of the Nvim GUI window as
a |List| with two numbers (result of |getwinposx()| and
|getwinposy()| combined).
{timeout} can be used to specify how long to wait in msec for
a response from the terminal. When omitted 100 msec is used.
a response. When omitted 100 msec is used.
Use a longer time for a remote terminal.
When using a value less than 10 and no response is received
@@ -5025,10 +5026,9 @@ M.funcs = {
},
getwinposx = {
desc = [=[
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
-1 if the information is not available.
The value can be used with `:winpos`.
Returns the X coordinate in pixels of the left hand side of
the Nvim GUI window, or -1 if not available. The value can be
used with `:winpos`.
]=],
name = 'getwinposx',
params = {},
@@ -5037,10 +5037,9 @@ M.funcs = {
},
getwinposy = {
desc = [=[
The result is a Number, which is the Y coordinate in pixels of
the top of the GUI Vim window. The result will be -1 if the
information is not available.
The value can be used with `:winpos`.
Returns the Y coordinate in pixels of the top of the Nvim GUI
window, or -1 if not available. The value can be used with
`:winpos`.
]=],
name = 'getwinposy',
params = {},
@@ -5265,8 +5264,8 @@ M.funcs = {
args = 2,
base = 1,
desc = [=[
The result is a Number, which is TRUE if |Dictionary| {dict}
has an entry with key {key}. FALSE otherwise. The {key}
Checks whether |Dictionary| {dict} has an entry with key
{key}. Returns TRUE if so, FALSE otherwise. The {key}
argument is a string.
]=],
@@ -5279,9 +5278,10 @@ M.funcs = {
args = { 0, 2 },
base = 1,
desc = [=[
The result is a Number, which is 1 when the window has set a
local path via |:lcd| or when {winnr} is -1 and the tabpage
has set a local path via |:tcd|, otherwise 0.
Checks whether the window or tabpage has set a local working
directory. Returns 1 when the window has set a local path
via |:lcd| or when {winnr} is -1 and the tabpage has set a
local path via |:tcd|, otherwise 0.
Tabs and windows are identified by their respective numbers,
0 means current tab or window. Missing argument implies 0.
@@ -5305,9 +5305,8 @@ M.funcs = {
args = { 1, 3 },
base = 1,
desc = [=[
The result is a Number, which is TRUE if there is a mapping
that contains {what} in somewhere in the rhs (what it is
mapped to) and this mapping exists in one of the modes
Checks whether a mapping exists whose rhs contains {what}.
Returns TRUE if there is such a mapping in one of the modes
indicated by {mode}.
The arguments {what} and {mode} are strings.
When {abbr} is there and it is |TRUE| use abbreviations
@@ -5438,9 +5437,9 @@ M.funcs = {
args = { 1, 2 },
base = 1,
desc = [=[
The result is a String, the entry with Number {index} from
{history}. See |hist-names| for the possible values of
{history}, and |:history-indexing| for {index}. If there is
Returns an entry from the specified command-line {history}.
See |hist-names| for the possible values of {history}, and
|:history-indexing| for {index}. If there is
no such entry, an empty String is returned. When {index} is
omitted, the most recent item from the history is used.
@@ -5480,9 +5479,9 @@ M.funcs = {
args = 1,
base = 1,
desc = [=[
The result is a Number, which is the ID of the highlight group
with name {name}. When the highlight group doesn't exist,
zero is returned.
Returns the numeric ID of the highlight group with name
{name}. When the highlight group doesn't exist, zero is
returned.
This can be used to retrieve information about the highlight
group. For example, to get the background color of the
"Comment" group: >vim
@@ -5498,11 +5497,10 @@ M.funcs = {
args = 1,
base = 1,
desc = [=[
The result is a Number, which is TRUE if a highlight group
called {name} exists. This is when the group has been
defined in some way. Not necessarily when highlighting has
been defined for it, it may also have been used for a syntax
item.
Checks whether a highlight group called {name} exists.
Returns TRUE if the group has been defined in some way. Not
necessarily when highlighting has been defined for it, it may
also have been used for a syntax item.
]=],
name = 'hlexists',
@@ -5512,8 +5510,8 @@ M.funcs = {
},
hostname = {
desc = [=[
The result is a String, which is the name of the machine on
which Vim is currently running. Machine names greater than
Returns the hostname of the machine on which the Nvim server
(not the UI client) is currently running. Names greater than
256 characters long are truncated.
]=],
fast = true,
@@ -5526,8 +5524,8 @@ M.funcs = {
args = 3,
base = 1,
desc = [=[
The result is a String, which is the text {string} converted
from encoding {from} to encoding {to}.
Converts the encoding of {string} from {from} to {to}.
Returns the converted String.
When the conversion completely fails an empty string is
returned. When some characters could not be converted they
are replaced with "?".
@@ -5572,9 +5570,9 @@ M.funcs = {
args = 1,
base = 1,
desc = [=[
The result is a Number, which is indent of line {lnum} in the
current buffer. The indent is counted in spaces, the value
of 'tabstop' is relevant. {lnum} is used just like in
Returns the indent of line {lnum} in the current buffer.
The indent is counted in spaces, the value of 'tabstop' is
relevant. {lnum} is used just like in
|getline()|.
When {lnum} is invalid -1 is returned.
@@ -5684,10 +5682,10 @@ M.funcs = {
args = { 1, 3 },
base = 1,
desc = [=[
The result is a String, which is whatever the user typed on
the command-line. The {prompt} argument is either a prompt
string, or a blank string (for no prompt). A '\n' can be used
in the prompt to start a new line.
Prompts the user to enter text on the command-line, and
returns the text as a String. The {prompt} argument is either
a prompt string, or a blank string (for no prompt). A '\n'
can be used in the prompt to start a new line.
In the second form it accepts a single dictionary with the
following keys, any of which may be omitted:
@@ -5814,9 +5812,9 @@ M.funcs = {
args = 1,
base = 1,
desc = [=[
{textlist} must be a |List| of strings. This |List| is
displayed, one string per line. The user will be prompted to
enter a number, which is returned.
Displays a list of strings and prompts the user to select
one by entering a number. {textlist} must be a |List| of
strings. Returns the number the user entered.
The user can also select an item by clicking on it with the
mouse, if the mouse is enabled in the command line ('mouse' is
"a" or includes "c"). For the first string 0 is returned.
@@ -5945,8 +5943,8 @@ M.funcs = {
args = 1,
base = 1,
desc = [=[
The result is a Number, which is |TRUE| when {path} is an
absolute path.
Checks whether {path} is an absolute path. Returns |TRUE|
if so, |FALSE| otherwise.
On Unix, a path is considered absolute when it starts with
'/'.
On MS-Windows, it is considered absolute when it starts with
@@ -5970,10 +5968,9 @@ M.funcs = {
args = 1,
base = 1,
desc = [=[
The result is a Number, which is |TRUE| when a directory
with the name {directory} exists. If {directory} doesn't
exist, or isn't a directory, the result is |FALSE|. {directory}
is any expression, which is used as a String.
Returns |TRUE| if {directory} exists, or |FALSE| if it doesn't
exist or isn't a directory. {directory} is any expression,
which is used as a String.
]=],
fast = true,
@@ -6003,8 +6000,8 @@ M.funcs = {
args = 1,
base = 1,
desc = [=[
The result is a Number, which is |TRUE| when {expr} is the
name of a locked variable.
Returns |TRUE| if {expr} is the name of a locked variable,
else |FALSE|.
The string argument {expr} must be the name of a variable,
|List| item or |Dictionary| entry, not the variable itself!
Example: >vim
@@ -6355,7 +6352,7 @@ M.funcs = {
args = 1,
base = 1,
desc = [=[
The result is a Number, which is the length of the argument.
Returns the length of the argument.
When {expr} is a String or a Number the length in bytes is
used, as with |strlen()|.
When {expr} is a |List| the number of items in the |List| is
@@ -9127,11 +9124,11 @@ M.funcs = {
args = 2,
base = 1,
desc = [=[
The result is a Number, which is the character at position
[row, col] on the screen. This works for every possible
screen position, also status lines, window separators and the
command line. The top left position is row one, column one
The character excludes composing characters. For double-byte
Returns the character at screen position [row, col] as a
Number. This works for every possible screen position, also
status lines, window separators and the command line. The
top left position is row one, column one. The character
excludes composing characters. For double-byte
encodings it may only be the first byte.
This is mainly to be used for testing.
Returns -1 when row or col is out of range.
@@ -9146,9 +9143,10 @@ M.funcs = {
args = 2,
base = 1,
desc = [=[
The result is a |List| of Numbers. The first number is the same
as what |screenchar()| returns. Further numbers are
composing characters on top of the base character.
Returns the character and any composing characters at screen
position [row, col] as a |List| of Numbers. The first number
is the same as what |screenchar()| returns; further numbers
are composing characters on top of the base character.
This is mainly to be used for testing.
Returns an empty List when row or col is out of range.
@@ -9160,8 +9158,8 @@ M.funcs = {
},
screencol = {
desc = [=[
The result is a Number, which is the current screen column of
the cursor. The leftmost column has number 1.
Returns the current screen column of the cursor. The
leftmost column has number 1.
This function is mainly used for testing.
Note: Always returns the current screen column, thus if used
@@ -9183,9 +9181,9 @@ M.funcs = {
args = 3,
base = 1,
desc = [=[
The result is a Dict with the screen position of the text
character in window {winid} at buffer line {lnum} and column
{col}. {col} is a one-based byte index.
Returns the screen position of the text character in window
{winid} at buffer line {lnum} and column {col} as a Dict.
{col} is a one-based byte index.
The Dict has these members:
row screen row
col first screen column
@@ -9214,8 +9212,8 @@ M.funcs = {
},
screenrow = {
desc = [=[
The result is a Number, which is the current screen row of the
cursor. The top line has number one.
Returns the current screen row of the cursor. The top line
has number one.
This function is mainly used for testing.
Alternatively you can use |winline()|.
@@ -9230,10 +9228,9 @@ M.funcs = {
args = 2,
base = 1,
desc = [=[
The result is a String that contains the base character and
any composing characters at position [row, col] on the screen.
This is like |screenchars()| but returning a String with the
characters.
Returns the base character and any composing characters at
screen position [row, col] as a String. This is like
|screenchars()| but returning a String with the characters.
This is mainly to be used for testing.
Returns an empty String when row or col is out of range.
@@ -11525,13 +11522,12 @@ M.funcs = {
args = 1,
base = 1,
desc = [=[
The result is a Number, which is the number of characters
in String {string}. Composing characters are ignored.
Returns the number of characters in String {string}, ignoring
composing characters. Returns 0 on error or empty {string}.
|strchars()| can count the number of characters, counting
composing characters separately.
Returns 0 if {string} is empty or on error.
Also see |strlen()|, |strdisplaywidth()| and |strwidth()|.
]=],
@@ -11574,8 +11570,7 @@ M.funcs = {
args = { 1, 2 },
base = 1,
desc = [=[
The result is a Number, which is the number of characters
in String {string}.
Returns the number of characters in String {string}.
When {skipcc} is omitted or zero, composing characters are
counted separately.
When {skipcc} set to 1, composing characters are ignored.
@@ -11611,18 +11606,20 @@ M.funcs = {
args = { 1, 2 },
base = 1,
desc = [=[
The result is a Number, which is the number of display cells
String {string} occupies on the screen when it starts at {col}
(first column is zero). When {col} is omitted zero is used.
Otherwise it is the screen column where to start. This
matters for Tab characters.
Returns the number of display cells String {string} occupies
on the screen when it starts at {col} (first column is zero).
Returns zero on error.
When {col} is omitted zero is used. Otherwise it is the screen
column where to start. This matters for Tab characters.
The option settings of the current window are used. This
matters for anything that's displayed differently, such as
'tabstop' and 'display'.
When {string} contains characters with East Asian Width Class
Ambiguous, this function's return value depends on
'ambiwidth'.
Returns zero on error.
Also see |strlen()|, |strwidth()| and |strchars()|.
]=],
@@ -11635,10 +11632,9 @@ M.funcs = {
args = { 1, 2 },
base = 1,
desc = [=[
The result is a String, which is a formatted date and time, as
specified by the {format} string. The given {time} is used,
or the current time if no time is given. The accepted
{format} depends on your system, thus this is not portable!
Formats a date and time String specified by {format}. The
given {time} is used, or the current time if no time is given.
The {format} depends on your system, this is not portable!
See the manual page of the C function strftime() for the
format. The maximum length of the result is 80 characters.
See also |localtime()|, |getftime()| and |strptime()|.
@@ -11679,8 +11675,8 @@ M.funcs = {
args = { 2, 3 },
base = 1,
desc = [=[
The result is a Number, which gives the byte index in
{haystack} of the first occurrence of the String {needle}.
Returns the byte index of the first occurrence of {needle}
in {haystack}.
If {start} is specified, the search starts at index {start}.
This can be used to find a second match: >vim
let colon1 = stridx(line, ":")
@@ -11708,9 +11704,10 @@ M.funcs = {
args = 1,
base = 1,
desc = [=[
Return {expr} converted to a String. If {expr} is a Number,
Float, String, Blob or a composition of them, then the result
can be parsed back with |eval()|.
Converts {expr} to a String. If {expr} is a Number, Float,
String, Blob or a composition of them, the result can be
parsed back with |eval()|.
{expr} type result ~
String 'string'
Number 123
@@ -11720,14 +11717,16 @@ M.funcs = {
Blob 0z00112233.44556677.8899
List [item, item]
Dictionary `{key: value, key: value}`
Note that in String values the ' character is doubled.
Note: in String values the ' character is doubled.
Also see |strtrans()|.
Note 2: Output format is mostly compatible with YAML, except
for infinite and NaN floating-point values representations
which use |str2float()|. Strings are also dumped literally,
only single quote is escaped, which does not allow using YAML
for parsing back binary strings. |eval()| should always work
for strings and floats though, and this is the only official
Note: Output format is mostly compatible with YAML, except for
infinite and NaN floating-point values representations which
use |str2float()|. Strings are also dumped literally, only
single quote is escaped, which does not allow using YAML for
parsing back binary strings. |eval()| should always work for
strings and floats though, and this is the only official
method. Use |msgpackdump()| or |json_encode()| if you need to
share data with other applications.
@@ -11741,8 +11740,7 @@ M.funcs = {
args = 1,
base = 1,
desc = [=[
The result is a Number, which is the length of the String
{string} in bytes.
Returns the length of String {string} in bytes.
If the argument is a Number it is first converted to a String.
For other types an error is given and zero is returned.
If you want to count the number of multibyte characters use
@@ -11759,12 +11757,14 @@ M.funcs = {
args = { 2, 4 },
base = 1,
desc = [=[
The result is a String, which is part of {src}, starting from
byte {start}, with the byte length {len}.
Gets a substring from {src}, starting from byte {start}, with
byte length {len}. Returns empty string on error.
When {chars} is present and TRUE then {len} is the number of
characters positions (composing characters are not counted
separately, thus "1" means one base character and any
following composing characters).
To count {start} as characters instead of bytes use
|strcharpart()|.
@@ -11781,7 +11781,6 @@ M.funcs = {
example, to get the character under the cursor: >vim
strpart(getline("."), col(".") - 1, 1, v:true)
<
Returns an empty string on error.
]=],
fast = true,
@@ -11799,14 +11798,12 @@ M.funcs = {
args = 2,
base = 1,
desc = [=[
The result is a Number, which is a unix timestamp representing
the date and time in {timestring}, which is expected to match
the format specified in {format}.
Parses a date/time string and returns a unix timestamp.
{timestring} must match the format specified in {format}.
The accepted {format} depends on your system, thus this is not
portable! See the manual page of the C function strptime()
for the format. Especially avoid "%c". The value of $TZ also
matters.
The {format} depends on your system, this is not portable!
See the strptime() manpage for the format. Especially avoid
"%c". The value of $TZ also matters.
If the {timestring} cannot be parsed with {format} zero is
returned. If you do not know the format of {timestring} you
@@ -11832,8 +11829,8 @@ M.funcs = {
args = { 2, 3 },
base = 1,
desc = [=[
The result is a Number, which gives the byte index in
{haystack} of the last occurrence of the String {needle}.
Returns the byte index of the last occurrence of {needle}
in {haystack}.
When {start} is specified, matches beyond this index are
ignored. This can be used to find a match before a previous
match: >vim
@@ -11863,9 +11860,9 @@ M.funcs = {
args = 1,
base = 1,
desc = [=[
The result is a String, which is {string} with all unprintable
characters translated into printable characters 'isprint'.
Like they are shown in a window. Example: >vim
Translates all unprintable characters in {string} into
printable characters 'isprint', like they are shown in a
window. Example: >vim
echo strtrans(@a)
<This displays a newline in register a as "^@" instead of
starting a new line.
@@ -11883,8 +11880,8 @@ M.funcs = {
args = { 1, 2 },
base = 1,
desc = [=[
The result is a Number, which is the number of UTF-16 code
units in String {string} (after converting it to UTF-16).
Returns the number of UTF-16 code units in String {string}
(after converting it to UTF-16).
When {countcc} is TRUE, composing characters are counted
separately.
@@ -11911,9 +11908,9 @@ M.funcs = {
args = 1,
base = 1,
desc = [=[
The result is a Number, which is the number of display cells
String {string} occupies. A Tab character is counted as one
cell, alternatively use |strdisplaywidth()|.
Returns the number of display cells String {string} occupies.
A Tab character is counted as one cell, alternatively use
|strdisplaywidth()|.
When {string} contains characters with East Asian Width Class
Ambiguous, this function's return value depends on
'ambiwidth'.
@@ -11976,8 +11973,8 @@ M.funcs = {
args = 4,
base = 1,
desc = [=[
The result is a String, which is a copy of {string}, in which
the first match of {pat} is replaced with {sub}.
Performs string substitution. Returns a copy of {string}
in which the first match of {pat} is replaced with {sub}.
When {flags} is "g", all matches of {pat} in {string} are
replaced. Otherwise {flags} should be "".
@@ -12051,8 +12048,8 @@ M.funcs = {
args = 1,
base = 1,
desc = [=[
The result is a dictionary, which holds information about the
swapfile {fname}. The available fields are:
Returns information about the swapfile {fname} as a
dictionary. The available fields are:
version Vim version
user user name
host host name
@@ -12092,10 +12089,9 @@ M.funcs = {
synID = {
args = 3,
desc = [=[
The result is a Number, which is the syntax ID at the position
{lnum} and {col} in the current window.
The syntax ID can be used with |synIDattr()| and
|synIDtrans()| to obtain syntax information about text.
Returns the syntax ID at position {lnum} and {col} in the
current window. The syntax ID can be used with |synIDattr()|
and |synIDtrans()| to obtain syntax information about text.
{col} is 1 for the leftmost column, {lnum} is 1 for the first
line. 'synmaxcol' applies, in a longer line zero is returned.
@@ -12126,9 +12122,9 @@ M.funcs = {
args = { 2, 3 },
base = 1,
desc = [=[
The result is a String, which is the {what} attribute of
syntax ID {synID}. This can be used to obtain information
about a syntax item.
Returns the {what} attribute of syntax ID {synID} as a
String. This can be used to obtain information about a
syntax item.
{mode} can be "gui" or "cterm", to get the attributes
for that mode. When {mode} is omitted, or an invalid value is
used, the attributes for the currently active highlighting are
@@ -12184,9 +12180,9 @@ M.funcs = {
args = 1,
base = 1,
desc = [=[
The result is a Number, which is the translated syntax ID of
{synID}. This is the syntax group ID of what is being used to
highlight the character. Highlight links given with
Returns the translated syntax ID of {synID}, following
highlight links. This is the syntax group ID of what is
being used to highlight the character. Highlight links given with
":highlight link" are followed.
Returns zero on error.
@@ -12200,10 +12196,11 @@ M.funcs = {
synconcealed = {
args = 2,
desc = [=[
The result is a |List| with three items:
1. The first item in the list is 0 if the character at the
position {lnum} and {col} is not part of a concealable
region, 1 if it is. {lnum} is used like with |getline()|.
Returns conceal information for the character at position
{lnum} and {col} as a |List| with three items:
1. The first item in the list is 0 if the character is not
part of a concealable region, 1 if it is. {lnum} is used
like with |getline()|.
2. The second item in the list is a string. If the first item
is 1, the second item contains the text which will be
displayed in place of the concealed text, depending on the
@@ -12354,8 +12351,8 @@ M.funcs = {
args = { 0, 1 },
base = 1,
desc = [=[
The result is a |List|, where each item is the number of the
buffer associated with each window in the current tab page.
Returns a |List| of buffer numbers, one for each window in
the specified tab page.
{arg} specifies the number of the tab page to be used. When
omitted the current tab page is used.
When {arg} is invalid the number zero is returned.
@@ -12374,8 +12371,8 @@ M.funcs = {
tabpagenr = {
args = { 0, 1 },
desc = [=[
The result is a Number, which is the number of the current
tab page. The first tab page has number 1.
Returns the number of the current tab page. The first tab
page has number 1.
The optional argument {arg} supports the following values:
$ the number of the last tab page (the tab page
@@ -12670,9 +12667,8 @@ M.funcs = {
args = 1,
base = 1,
desc = [=[
The result is a copy of the String given, with all uppercase
characters turned into lowercase (just like applying |gu| to
the string). Returns an empty string on error.
Converts a String to lowercase (like applying |gu|).
Returns empty string on error.
]=],
fast = true,
@@ -12685,9 +12681,8 @@ M.funcs = {
args = 1,
base = 1,
desc = [=[
The result is a copy of the String given, with all lowercase
characters turned into uppercase (just like applying |gU| to
the string). Returns an empty string on error.
Converts a String to uppercase (like applying |gU|).
Returns empty string on error.
]=],
fast = true,
@@ -12700,11 +12695,9 @@ M.funcs = {
args = 3,
base = 1,
desc = [=[
The result is a copy of the {src} string with all characters
which appear in {fromstr} replaced by the character in that
position in the {tostr} string. Thus the first character in
{fromstr} is translated into the first character in {tostr}
and so on. Exactly like the unix "tr" command.
Translates characters in {src}, replacing each character that
appears in {fromstr} with the corresponding character in
{tostr}. Exactly like the unix "tr" command.
This code also deals with multibyte characters properly.
Returns an empty string on error.
@@ -12785,7 +12778,7 @@ M.funcs = {
args = 1,
base = 1,
desc = [=[
The result is a Number representing the type of {expr}.
Returns the type of {expr} as a Number.
Instead of using the number directly, it is better to use the
v:t_ variable that has the value:
Number: 0 |v:t_number|
@@ -12973,10 +12966,10 @@ M.funcs = {
args = { 1, 3 },
base = 1,
desc = [=[
The result is a Number, which is the screen column of the file
position given with {expr}. That is, the total number of
screen cells occupied by the part of the line until the end of
the character at that position. When there is a <Tab> at the
Returns the virtual (screen) column of the file position
given with {expr}. That is, the total number of screen cells
occupied by the part of the line until the end of the
character at that position. When there is a <Tab> at the
position, the returned Number will be the column at the end of
the <Tab>. For example, for a <Tab> in column 1, with 'ts'
set to 8, it returns 8. |conceal| is ignored.
@@ -13030,9 +13023,9 @@ M.funcs = {
args = 3,
base = 1,
desc = [=[
The result is a Number, which is the byte index of the
character in window {winid} at buffer line {lnum} and virtual
column {col}.
Converts a virtual column to a byte index. Returns the byte
index of the character in window {winid} at buffer line
{lnum} and virtual column {col}.
If buffer line {lnum} is an empty line, 0 is returned.
@@ -13060,9 +13053,9 @@ M.funcs = {
visualmode = {
args = { 0, 1 },
desc = [=[
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",
Returns a String describing 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",
"V", or "<CTRL-V>" (a single CTRL-V character) for
character-wise, line-wise, or block-wise Visual mode
respectively.
@@ -13358,9 +13351,8 @@ M.funcs = {
args = 1,
base = 1,
desc = [=[
The result is a Number, which is the number of the buffer
associated with window {nr}. {nr} can be the window number or
the |window-ID|.
Returns the buffer number associated with window {nr}.
{nr} can be the window number or the |window-ID|.
When {nr} is zero, the number of the buffer in the current
window is returned.
When window {nr} doesn't exist, -1 is returned.
@@ -13375,9 +13367,9 @@ M.funcs = {
},
wincol = {
desc = [=[
The result is a Number, which is the virtual column of the
cursor in the window. This is counting screen cells from the
left side of the window. The leftmost column is one.
Returns the virtual column of the cursor in the window.
This is counting screen cells from the left side of the
window. The leftmost column is one.
]=],
name = 'wincol',
params = {},
@@ -13386,10 +13378,11 @@ M.funcs = {
},
windowsversion = {
desc = [=[
The result is a String. For MS-Windows it indicates the OS
version. E.g, Windows 10 is "10.0", Windows 8 is "6.2",
Windows XP is "5.1". For non-MS-Windows systems the result is
an empty string.
Returns the Windows OS version as a String. E.g, Windows 10
is "10.0", Windows 8 is "6.2", Windows XP is "5.1". For
non-MS-Windows systems the result is an empty string.
See also Lua |uv.os_uname()|.
]=],
fast = true,
name = 'windowsversion',
@@ -13419,8 +13412,7 @@ M.funcs = {
args = { 0, 1 },
base = 1,
desc = [=[
The result is a nested List containing the layout of windows
in a tabpage.
Returns the layout of windows in a tabpage as a nested List.
Without {tabnr} use the current tabpage, otherwise the tabpage
with number {tabnr}. If the tabpage {tabnr} is not found,
@@ -13462,9 +13454,9 @@ M.funcs = {
},
winline = {
desc = [=[
The result is a Number, which is the screen line of the cursor
in the window. This is counting screen lines from the top of
the window. The first line is one.
Returns the screen line of the cursor in the window. This is
counting screen lines from the top of the window. The first
line is one.
If the cursor was moved the view on the file will be updated
first, this may cause a scroll.
]=],
@@ -13477,10 +13469,9 @@ M.funcs = {
args = { 0, 1 },
base = 1,
desc = [=[
The result is a Number, which is the number of the current
window. The top window has number 1.
Returns zero for a hidden or non |focusable| window, unless
it is the current window.
Returns the number of the current window. The top window has
number 1. Returns zero for a hidden or non |focusable|
window, unless it is the current window.
The optional argument {arg} supports the following values:
$ the number of the last window (the window
@@ -13616,9 +13607,8 @@ M.funcs = {
},
wordcount = {
desc = [=[
The result is a dictionary of byte/chars/word statistics for
the current buffer. This is the same info as provided by
|g_CTRL-G|
Returns a dictionary of byte/chars/word statistics for the
current buffer. This is the same info provided by |g_CTRL-G|.
The return value includes:
bytes Number of bytes in the buffer
chars Number of chars in the buffer