mirror of
https://github.com/neovim/neovim.git
synced 2025-09-09 21:08:17 +00:00
doc: API
This commit is contained in:
@@ -638,7 +638,7 @@ nvim_set_client_info({name}, {version}, {type}, {methods},
|
|||||||
Clients might define their own keys, but the
|
Clients might define their own keys, but the
|
||||||
following are suggested: "website" Website
|
following are suggested: "website" Website
|
||||||
of client (for instance github repository)
|
of client (for instance github repository)
|
||||||
"license" Informal descripton of the
|
"license" Informal description of the
|
||||||
license, such as "Apache 2", "GPLv3" or
|
license, such as "Apache 2", "GPLv3" or
|
||||||
"MIT" "logo" URI or path to image,
|
"MIT" "logo" URI or path to image,
|
||||||
preferably small logo or icon. .png or .svg
|
preferably small logo or icon. .png or .svg
|
||||||
@@ -862,8 +862,7 @@ nvim_buf_line_count({buffer}) *nvim_buf_line_count()*
|
|||||||
{buffer} Buffer handle
|
{buffer} Buffer handle
|
||||||
|
|
||||||
Return: ~
|
Return: ~
|
||||||
Line count, or `0` if the buffer has been unloaded (see
|
Line count, or 0 for unloaded buffer. |api-buffer|
|
||||||
|api-buffer|).
|
|
||||||
|
|
||||||
nvim_buf_attach({buffer}, {send_buffer}, {opts}) *nvim_buf_attach()*
|
nvim_buf_attach({buffer}, {send_buffer}, {opts}) *nvim_buf_attach()*
|
||||||
Activate updates from this buffer to the current channel.
|
Activate updates from this buffer to the current channel.
|
||||||
@@ -912,8 +911,7 @@ nvim_buf_get_lines({buffer}, {start}, {end}, {strict_indexing})
|
|||||||
error.
|
error.
|
||||||
|
|
||||||
Return: ~
|
Return: ~
|
||||||
Array of lines. If the buffer has been unloaded then an
|
Array of lines, or empty array for unloaded buffer.
|
||||||
empty array will be returned instead. (See |api-buffer|.)
|
|
||||||
|
|
||||||
*nvim_buf_set_lines()*
|
*nvim_buf_set_lines()*
|
||||||
nvim_buf_set_lines({buffer}, {start}, {end}, {strict_indexing},
|
nvim_buf_set_lines({buffer}, {start}, {end}, {strict_indexing},
|
||||||
@@ -940,6 +938,25 @@ nvim_buf_set_lines({buffer}, {start}, {end}, {strict_indexing},
|
|||||||
error.
|
error.
|
||||||
{replacement} Array of lines to use as replacement
|
{replacement} Array of lines to use as replacement
|
||||||
|
|
||||||
|
nvim_buf_get_offset({buffer}, {index}) *nvim_buf_get_offset()*
|
||||||
|
Returns the byte offset for a line.
|
||||||
|
|
||||||
|
Line 1 (index=0) has offset 0. UTF-8 bytes are counted. EOL is
|
||||||
|
one byte. 'fileformat' and 'fileencoding' are ignored. The
|
||||||
|
line index just after the last line gives the total byte-count
|
||||||
|
of the buffer. A final EOL byte is counted if it would be
|
||||||
|
written, see 'eol'.
|
||||||
|
|
||||||
|
Unlike |line2byte()|, throws error for out-of-bounds indexing.
|
||||||
|
Returns -1 for unloaded buffer.
|
||||||
|
|
||||||
|
Parameters: ~
|
||||||
|
{buffer} Buffer handle
|
||||||
|
{index} Line index
|
||||||
|
|
||||||
|
Return: ~
|
||||||
|
Integer byte offset, or -1 for unloaded buffer.
|
||||||
|
|
||||||
nvim_buf_get_var({buffer}, {name}) *nvim_buf_get_var()*
|
nvim_buf_get_var({buffer}, {name}) *nvim_buf_get_var()*
|
||||||
Gets a buffer-scoped (b:) variable.
|
Gets a buffer-scoped (b:) variable.
|
||||||
|
|
||||||
@@ -1106,8 +1123,8 @@ nvim_buf_add_highlight({buffer}, {src_id}, {hl_group}, {line},
|
|||||||
|
|
||||||
*nvim_buf_clear_highlight()*
|
*nvim_buf_clear_highlight()*
|
||||||
nvim_buf_clear_highlight({buffer}, {src_id}, {line_start}, {line_end})
|
nvim_buf_clear_highlight({buffer}, {src_id}, {line_start}, {line_end})
|
||||||
Clears highlights from a given source group and a range of
|
Clears highlights and virtual text from a given source id and
|
||||||
lines
|
range of lines
|
||||||
|
|
||||||
To clear a source group in the entire buffer, pass in 0 and -1
|
To clear a source group in the entire buffer, pass in 0 and -1
|
||||||
to line_start and line_end respectively.
|
to line_start and line_end respectively.
|
||||||
@@ -1132,6 +1149,10 @@ nvim_buf_set_virtual_text({buffer}, {src_id}, {line}, {chunks},
|
|||||||
the right of the ordinary text, this will contain the |lcs-
|
the right of the ordinary text, this will contain the |lcs-
|
||||||
eol| char if set, otherwise just be a space.
|
eol| char if set, otherwise just be a space.
|
||||||
|
|
||||||
|
The same src_id can be used for both virtual text and
|
||||||
|
highlights added by nvim_buf_add_highlight. Virtual text is
|
||||||
|
cleared using nvim_buf_clear_highlight.
|
||||||
|
|
||||||
Parameters: ~
|
Parameters: ~
|
||||||
{buffer} Buffer handle
|
{buffer} Buffer handle
|
||||||
{src_id} Source group to use or 0 to use a new group, or
|
{src_id} Source group to use or 0 to use a new group, or
|
||||||
|
@@ -51,8 +51,7 @@
|
|||||||
///
|
///
|
||||||
/// @param buffer Buffer handle
|
/// @param buffer Buffer handle
|
||||||
/// @param[out] err Error details, if any
|
/// @param[out] err Error details, if any
|
||||||
/// @return Line count, or \`0` if the buffer has been unloaded (see
|
/// @return Line count, or 0 for unloaded buffer. |api-buffer|
|
||||||
/// |api-buffer|).
|
|
||||||
Integer nvim_buf_line_count(Buffer buffer, Error *err)
|
Integer nvim_buf_line_count(Buffer buffer, Error *err)
|
||||||
FUNC_API_SINCE(1)
|
FUNC_API_SINCE(1)
|
||||||
{
|
{
|
||||||
@@ -227,8 +226,7 @@ ArrayOf(String) buffer_get_line_slice(Buffer buffer,
|
|||||||
/// @param end Last line index (exclusive)
|
/// @param end Last line index (exclusive)
|
||||||
/// @param strict_indexing Whether out-of-bounds should be an error.
|
/// @param strict_indexing Whether out-of-bounds should be an error.
|
||||||
/// @param[out] err Error details, if any
|
/// @param[out] err Error details, if any
|
||||||
/// @return Array of lines. If the buffer has been unloaded then an empty array
|
/// @return Array of lines, or empty array for unloaded buffer.
|
||||||
/// will be returned instead. (See |api-buffer|.)
|
|
||||||
ArrayOf(String) nvim_buf_get_lines(uint64_t channel_id,
|
ArrayOf(String) nvim_buf_get_lines(uint64_t channel_id,
|
||||||
Buffer buffer,
|
Buffer buffer,
|
||||||
Integer start,
|
Integer start,
|
||||||
@@ -491,12 +489,12 @@ end:
|
|||||||
try_end(err);
|
try_end(err);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Return the byte offset for a line.
|
/// Returns the byte offset for a line.
|
||||||
//
|
///
|
||||||
/// The first line returns 0. UTF-8 bytes are counted, and EOL counts as one
|
/// Line 1 (index=0) has offset 0. UTF-8 bytes are counted. EOL is one byte.
|
||||||
/// byte. 'fileformat' and 'fileencoding' are ignored. Sending in the index
|
/// 'fileformat' and 'fileencoding' are ignored. The line index just after the
|
||||||
/// just below the last line gives the total byte count for the entire buffer.
|
/// last line gives the total byte-count of the buffer. A final EOL byte is
|
||||||
/// A final EOL is included if it would be written, see 'eol'.
|
/// counted if it would be written, see 'eol'.
|
||||||
///
|
///
|
||||||
/// Unlike |line2byte()|, throws error for out-of-bounds indexing.
|
/// Unlike |line2byte()|, throws error for out-of-bounds indexing.
|
||||||
/// Returns -1 for unloaded buffer.
|
/// Returns -1 for unloaded buffer.
|
||||||
@@ -504,7 +502,7 @@ end:
|
|||||||
/// @param buffer Buffer handle
|
/// @param buffer Buffer handle
|
||||||
/// @param index Line index
|
/// @param index Line index
|
||||||
/// @param[out] err Error details, if any
|
/// @param[out] err Error details, if any
|
||||||
/// @return Integer Byte offset
|
/// @return Integer byte offset, or -1 for unloaded buffer.
|
||||||
Integer nvim_buf_get_offset(Buffer buffer, Integer index, Error *err)
|
Integer nvim_buf_get_offset(Buffer buffer, Integer index, Error *err)
|
||||||
FUNC_API_SINCE(5)
|
FUNC_API_SINCE(5)
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user