import * as denopsStd from "https://deno.land/x/denops_std@v5.2.0/function/vim/mod.ts";
A module to provide functions of Vim native functions.
import { Denops } from "../../mod.ts";
import * as vimFn from "../../function/vim/mod.ts";
export async function main(denops: Denops): Promise<void> {
// vimFn holds functions exists only in Vim
console.log(vimFn.balloon_gettext(denops));
}
Functions
Run {cmd} and add an error message to | |
When {expected} and {actual} are not equal an error message is
added to | |
When the files {fname-one} and {fname-two} do not contain
exactly the same text an error message is added to | |
When v:exception does not contain the string {error} an error
message is added to | |
Run {cmd} and add an error message to | |
When {actual} is not false an error message is added to
| |
This asserts number and | |
When {pattern} does not match {actual} an error message is
added to | |
Run {cmd} and add an error message to | |
The opposite of | |
The opposite of | |
Report a test failure directly, using String {msg}. Always returns one. | |
When {actual} is not true an error message is added to
| |
Adds a List of autocmds and autocmd groups. | |
Deletes a List of autocmds and autocmd groups. | |
Returns a | |
Return the current text in the balloon. Only for the string, not used for the List. Returns an empty string if balloon is not present. | |
Show {expr} inside the balloon. For the GUI {expr} is used as
a string. For a terminal {expr} can be a list, which contains
the lines of the balloon. If {expr} is not a list it will be
split with | |
Split String {msg} into lines to be displayed in a balloon.
The splits are made for the current window size and optimize
to show debugger output.
Returns a | |
Return a List containing the number value of each byte in Blob {blob}. Examples: | |
Return non-zero when there is something to read from {handle}. {handle} can be a Channel or a Job that has a Channel. | |
Close {handle}. See | |
Close the "in" part of {handle}. See | |
Send {expr} over {handle}. The {expr} is encoded
according to the type of channel. The function cannot be used
with a raw channel. See | |
Send {string} over {handle}. {handle} can be a Channel or a Job that has a Channel. | |
Get the buffer number that {handle} is using for String {what}. {handle} can be a Channel or a Job that has a Channel. {what} can be "err" for stderr, "out" for stdout or empty for socket output. Returns -1 when there is no buffer. | |
Get the Job associated with {channel}.
If there is no job calling | |
Returns a Dictionary with information about {handle}. The items are: "id" number of the channel "status" "open", "buffered" or "closed", like ch_status() When opened with ch_open(): "hostname" the hostname of the address "port" the port of the address "path" the path of the Unix-domain socket "sock_status" "open" or "closed" "sock_mode" "NL", "RAW", "JSON" or "JS" "sock_io" "socket" "sock_timeout" timeout in msec | |
Write String {msg} in the channel log file, if it was opened
with | |
Start logging channel activity to {fname}. When {fname} is an empty string: stop logging. | |
Open a channel to {address}. See | |
Read from {handle} and return the received message.
{handle} can be a Channel or a Job that has a Channel.
For a NL channel this waits for a NL to arrive, except when
there is nothing more to read (channel was closed).
See | |
Like ch_read() but reads binary data and returns a | |
Like ch_read() but for a JS and JSON channel does not decode
the message. For a NL channel it does not block waiting for
the NL to arrive, but otherwise works like ch_read().
See | |
Send {expr} over {handle}. The {expr} is encoded
according to the type of channel. The function cannot be used
with a raw channel.
See | |
Send | |
Set options on {handle}:
"callback" the channel callback
"timeout" default read timeout in msec
"mode" mode for the whole channel
See | |
Return the status of {handle}:
"fail" failed to open the channel
"open" channel can be used
"buffered" channel can be read, not written to
"closed" channel can not be used
{handle} can be a Channel or a Job that has a Channel.
"buffered" is used when the channel was closed but there is
still data that can be obtained with | |
Output {string} as-is, including unprintable characters. This can be used to output a terminal code. For example, to disable modifyOtherKeys: | |
Like | |
Like | |
Like | |
Move the Vim window to the foreground. Useful when sent from
a client to a Vim server. | |
Just like | |
Returns a | |
The result is a Number, which is | |
Returns the name of the currently showing mouse pointer.
When the | |
Returns a | |
Translate String {text} if possible. This is mainly for use in the distributed Vim scripts. When generating message translations the {text} is extracted by xgettext, the translator can add the translated message in the .po file and Vim will lookup the translation when gettext() is called. For {text} double quoted strings are preferred, because xgettext does not understand escaping in single quoted strings. | |
Returns a List of all the highlight group attributes. If the optional {name} is specified, then returns a List with only the attributes of the specified highlight group. Returns an empty List if the highlight group {name} is not present. | |
Creates or modifies the attributes of a List of highlight
groups. Each item in {list} is a dictionary containing the
attributes of a highlight group. See | |
Returns the index of an item in {object} where {expr} is
v:true. {object} must be a | |
Like | |
The result is a Number, which is | |
Get the channel handle that {job} is using. To check if the job has no channel: | |
Returns a Dictionary with information about {job}:
"status" what | |
Change options for {job}. Supported are:
"stoponexit" | |
Start a job and return a Job object. Unlike | |
Returns a String with the status of {job}: "run" job is running "fail" job failed to start "dead" job died or was stopped after running | |
Stop the {job}. This can also be used to signal the job. | |
This is similar to
| |
This is similar to
| |
Return a Blob concatenating all the number values in {list}. Examples: | |
Add a callback function that will be invoked when changes have
been made to buffer {buf}.
{buf} refers to a buffer name or number. For the accepted
values, see | |
Invoke listener callbacks for buffer {buf}. If there are no pending changes then no callbacks are invoked. | |
Remove a listener previously added with listener_add(). Returns FALSE when {id} could not be found, TRUE when {id} was removed. | |
Evaluate Lua expression {expr} and return its result converted
to Vim data structures. Second {expr} may hold additional
argument accessible as _A inside first {expr}.
Strings are returned as they are.
Boolean objects are converted to numbers.
Numbers are converted to | |
Returns a | |
Like | |
Evaluate MzScheme expression {expr} and return its result
converted to Vim data structures.
Numbers and strings are returned as they are.
Pairs (including lists and improper lists) and vectors are
returned as Vim | |
Attach a text property at position {lnum}, {col}. {col} is counted in bytes, use one for the first column. If {lnum} is invalid an error is given. If {col} is invalid an error is given. | |
Similar to prop_add(), but attaches a text property at multiple positions in a buffer. | |
Remove all text properties from line {lnum}. When {lnum-end} is given, remove all text properties from line {lnum} to {lnum-end} (inclusive). | |
Search for a text property as specified with {props}: id property with this ID type property with this type name both "id" and "type" must both match bufnr buffer to search in; when present a start position with "lnum" and "col" must be given; when omitted the current buffer is used lnum start in this line (when omitted start at the cursor) col start at this column (when omitted and "lnum" is given: use column 1, otherwise start at the cursor) skipstart do not look for a match at the start position | |
Returns a List with all the text properties in line {lnum}. | |
Remove a matching text property from line {lnum}. When {lnum-end} is given, remove matching text properties from line {lnum} to {lnum-end} (inclusive). When {lnum} is omitted remove matching text properties from all lines (this requires going over all lines, thus will be a bit slow for a buffer with many lines). | |
Add a text property type {name}. If a property type with this name already exists an error is given. Nothing is returned. {props} is a dictionary with these optional fields: bufnr define the property only for this buffer; this avoids name collisions and automatically clears the property types when the buffer is deleted. highlight name of highlight group to use priority when a character has multiple text properties the one with the highest priority will be used; negative values can be used, the default priority is zero combine when omitted or TRUE combine the highlight with any syntax highlight; when FALSE syntax highlight will not be used override when TRUE the highlight overrides any other, including 'cursorline' and Visual start_incl when TRUE inserts at the start position will be included in the text property end_incl when TRUE inserts at the end position will be included in the text property | |
Change properties of an existing text property type. If a
property with this name does not exist an error is given.
The {props} argument is just like | |
Remove the text property type {name}. When text properties using the type {name} are still in place, they will not have an effect and can no longer be removed by name. | |
Returns the properties of property type {name}. This is a dictionary with the same fields as was given to prop_type_add(). When the property type {name} does not exist, an empty dictionary is returned. | |
Returns a list with all property type names. | |
Read file {fname} in binary mode and return a | |
Extended version of | |
Send the {string} to {server}. The {server} argument is a
string, also see | |
Move the Vim server with the name {server} to the foreground.
The {server} argument is a string, also see | |
Returns a positive number if there are available strings
from {serverid}. Copies any reply string into the variable
{retvar} if specified. {retvar} must be a string with the
name of a variable.
Returns zero if none are available.
Returns -1 if something is wrong.
See also | |
Return the oldest available reply from {serverid} and consume
it. Unless a {timeout} in seconds is given, it blocks until a
reply is available. Returns an empty string, if a reply is
not available or on error.
See also | |
Send the {string} to {server}. The {server} argument is a
string, also see | |
Become the server {name}. This fails if already running as a
server, when | |
Send a reply string to {clientid}. The most recent {clientid}
that sent a string can be retrieved with expand( | |
Similar to using a | |
Stop playing all sounds. | |
Play a sound identified by {name}. Which event names are supported depends on the system. Often the XDG sound names are used. On Ubuntu they may be found in /usr/share/sounds/freedesktop/stereo. Example: | |
Like | |
Stop playing sound {id}. {id} must be previously returned by
| |
Return a string which contains characters indicating the current state. Mostly useful in callbacks that want to do work that may not always be safe. Roughly this works like:
| |
The result is a Number, which is the number of characters
in String {string}. Composing characters are ignored.
| |
The result is a Number, which is the number of UTF-16 code units in String {string} (after converting it to UTF-16). | |
Returns a list of swap file names, like what "vim -r" shows.
See the | |
Open a new window displaying the difference between the two
files. The files must have been created with
| |
Open a new window displaying the contents of {filename}
The file must have been created with | |
Dump the contents of the terminal screen of {buf} in the file
{filename}. This uses a format that can be used with
| |
Returns 1 if the terminal of {buf} is using the alternate
screen.
{buf} is used as with | |
Get the ANSI color palette in use by terminal {buf}.
Returns a List of length 16 where each element is a String
representing a color in hexadecimal "#rrggbb" format.
Also see | |
Given {attr}, a value returned by term_scrape() in the "attr" item, return whether {what} is on. {what} can be one of: bold italic underline strike reverse | |
Get the cursor position of terminal {buf}. Returns a list with two numbers and a dictionary: [row, col, dict]. | |
Get the Job associated with terminal window {buf}.
{buf} is used as with | |
Get a line of text from the terminal window of {buf}.
{buf} is used as with | |
Return the number of lines that scrolled to above the top of
terminal {buf}. This is the offset between the row number
used for | |
Get the size of terminal {buf}. Returns a list with two numbers: [rows, cols]. This is the size of the terminal, not the window containing the terminal. | |
Get the status of terminal {buf}. This returns a String with a comma-separated list of these items: running job is running finished job has finished normal in Terminal-Normal mode One of "running" or "finished" is always present. | |
Get the title of terminal {buf}. This is the title that the job in the terminal has set. | |
Get the name of the controlling terminal associated with
terminal window {buf}. {buf} is used as with | |
Return a list with the buffer numbers of all buffers for terminal windows. | |
Get the contents of {row} of terminal screen of {buf}.
For {buf} see | |
Send keystrokes {keys} to terminal {buf}.
{buf} is used as with | |
Set the ANSI color palette used by terminal {buf}.
{colors} must be a List of 16 valid color names or hexadecimal
color codes, like those accepted by | |
Set the function name prefix to be used for the | |
When exiting Vim or trying to close the terminal window in
another way, {how} defines whether the job in the terminal can
be stopped.
When {how} is empty (the default), the job will not be
stopped, trying to exit will result in | |
Set the command to write in a session file to restore the job in this terminal. The line written in the session file is: | |
Set the size of terminal {buf}. The size of the window containing the terminal will also be adjusted, if possible. If {rows} or {cols} is zero or negative, that dimension is not changed. | |
Open a terminal window and run {cmd} in it. | |
Wait for pending updates of {buf} to be handled.
{buf} is used as with | |
Returns a | |
This is for testing: If the memory allocation with {id} is called, then decrement {countdown}, and when it reaches zero let memory allocation fail {repeat} times. When {repeat} is smaller than one it fails one time. | |
Set a flag to enable the effect of 'autochdir' before Vim startup has finished. | |
Characters in {string} are queued for processing as if they
were typed by the user. This uses a low level input buffer.
This function works only when with | |
Like garbagecollect(), but executed right away. This must
only be called directly to avoid any structure to exist
internally, and | |
Set the flag to call the garbagecollector as if in the main loop. Only to be used in tests. | |
Get the value of an internal variable. These values for {name} are supported: need_fileinfo | |
Generate a GUI {event} with arguments {args} for testing Vim functionality. This function works only when the GUI is running. | |
Ignore any error containing {expr}. A normal message is given instead. This is only meant to be used in tests, where catching the error with try/catch cannot be used (because it skips over following code). {expr} is used literally, not as a pattern. When the {expr} is the string "RESET" then the list of ignored errors is made empty. | |
Generate a low-level MS-Windows {event} with arguments {args} for testing Vim functionality. It works for MS-Windows GUI and for the console. | |
Return a | |
Return a | |
Return a | |
Return a | |
Return a | |
Return a | |
Return a | |
Return a | |
Reset the flag that indicates option {name} was set. Thus it looks like it still has the default value. Use like this: | |
Overrides certain parts of Vim's internal processing to be able to run tests. Only to be used for testing Vim! The override is enabled when {val} is non-zero and removed when {val} is zero. Current supported values for {name} are: | |
Return the reference count of {expr}. When {expr} is of a type that does not have a reference count, returns -1. Only to be used for testing. | |
Set the mouse position to be used for the next mouse action. {row} and {col} are one based. For example: | |
Set the time Vim uses internally. Currently only used for timestamps in the history, as they are used in viminfo, and for undo. Using a value of 1 makes Vim not sleep after a warning or error message. {expr} must evaluate to a number. When the value is zero the normal behavior is restored. | |
When [seed] is given this sets the seed value used by
| |
Return a value with unknown type. Only useful for testing. | |
Return a value with void type. Only useful for testing. | |
Return a string representation of the type of {expr}. Example: | |
Same as |