First line index
• {end} Last line index, exclusive
• {strict_indexing} Whether out-of-bounds should be an error.
Return: ~
Array of lines, or empty array for unloaded buffer.
See also: ~
• |nvim_buf_get_text()|
nvim_buf_get_mark({buffer}, {name}) *nvim_buf_get_mark()*
Returns a `(row,col)` tuple representing the position of the named mark.
"End of line" column position is returned as |v:maxcol| (big number). See
|mark-motions|.
Marks are (1,0)-indexed. |api-indexing|
Attributes: ~
Since: 0.1.0
Parameters: ~
• {buffer} Buffer id, or 0 for current buffer
• {name} Mark name
Return: ~
(row, col) tuple, (0, 0) if the mark is not set, or is an
uppercase/file mark set in another buffer.
See also: ~
• |nvim_buf_set_mark()|
• |nvim_buf_del_mark()|
nvim_buf_get_name({buffer}) *nvim_buf_get_name()*
Gets the full file name for the buffer
Attributes: ~
Since: 0.1.0
Parameters: ~
• {buffer} Buffer id, or 0 for current buffer
Return: ~
Buffer name
nvim_buf_get_offset({buffer}, {index}) *nvim_buf_get_offset()*
Returns the byte offset of a line (0-indexed). |api-indexing|
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.
Attributes: ~
Since: 0.3.2
Parameters: ~
• {buffer} Buffer id, or 0 for current buffer
• {index} Line index
Return: ~
Integer byte offset, or -1 for unloaded buffer.
*nvim_buf_get_text()*
nvim_buf_get_text({buffer}, {start_row}, {start_col}, {end_row}, {end_col},
{opts})
Gets a range from the buffer (may be partial lines, unlike
|nvim_buf_get_lines()|).
Indexing is zero-based. Row indices are end-inclusive, and column indices
are end-exclusive.
Prefer |nvim_buf_get_lines()| when retrieving entire lines.
Attributes: ~
Since: 0.7.0
Parameters: ~
• {buffer} Buffer id, or 0 for current buffer
• {start_row} First line index
• {start_col} Starting column (byte offset) on first line
• {end_row} Last line index, inclusive
• {end_col} Ending column (byte offset) on last line, exclusive
• {opts} Optional parameters. Currently unused.
Return: ~
Array of lines, or empty array for unloaded buffer.
nvim_buf_get_var({buffer}, {name}) *nvim_buf_get_var()*
Gets a buffer-scoped (b:) variable.
Attributes: ~
Since: 0.1.0
Parameters: ~
• {buffer} Buffer id, or 0 for current buffer
• {name} Variable name
Return: ~
Variable value
nvim_buf_is_loaded({buffer}) *nvim_buf_is_loaded()*
Checks if a buffer is valid and loaded. See |api-buffer| for more info
about unloaded buffers.
Attributes: ~
Since: 0.3.2
Parameters: ~
• {buffer} Buffer id, or 0 for current buffer
Return: ~
true if the buffer is valid and loaded, false otherwise.
nvim_buf_is_valid({buffer}) *nvim_buf_is_valid()*
Checks if a buffer is valid.
Note: ~
• Even if a buffer is valid it may have been unloaded. See |api-buffer|
for more info about unloaded buffers.
Attributes: ~
Since: 0.1.0
Parameters: ~
• {buffer} Buffer id, or 0 for current buffer
Return: ~
true if the buffer is valid, false otherwise.
nvim_buf_line_count({buffer})