pub struct Buffer(_);
Expand description

A newtype struct wrapping a Neovim buffer. All the nvim_buf_* functions taking a buffer handle as their first argument are implemented as methods on this object.

Implementations

Binding to nvim_buf_attach.

Used to register a set of callbacks on specific buffer events.

Binding to nvim_buf_call.

Calls a function with this buffer as the temporary current buffer.

Binding to nvim_buf_create_user_command.

Creates a new buffer-local user command.

Binding to nvim_buf_del_keymap.

Unmaps a buffer-local mapping for the given mode.

Binding to nvim_buf_del_mark.

Deletes a named mark in the buffer.

Binding to nvim_buf_del_user_command.

Deletes a buffer-local user-command. Use api::del_user_command to delete a global command.

Binding to nvim_buf_del_var.

Removes a buffer-scoped (b:) variable.

Binding to nvim_buf_delete.

Deletes the buffer (not allowed while textlock is active).

Binding to nvim_buf_get_keymap.

Binding to nvim_buf_get_lines.

Gets a line range from the buffer. Indexing is zero-based, end-exclusive. Out of bounds indices are clamped to the nearest valid value, unless strict_indexing is set, in which case passing an invalid index will cause an error.

Binding to nvim_buf_get_mark.

Returns a (1-0) indexed (row, col) tuple representing the position of the named mark.

Binding to nvim_buf_get_name.

Returns the full filepath of the buffer.

Binding to nvim_buf_get_offset.

Returns the 0-indexed byte offset of a line.

Binding to nvim_buf_get_option.

Gets a buffer option value.

Binding to nvim_buf_get_text.

Gets a range from the buffer. This differs from Buffer::get_lines in that it allows retrieving only portions of a line.

Indexing is zero-based, with both row and column indices being end-exclusive.

Binding to nvim_buf_get_var.

Gets a buffer-scoped (b:) variable.

Binding to nvim_buf_is_loaded.

Checks if a buffer is valid and loaded.

Binding to nvim_buf_is_valid.

Checks if a buffer is valid.

Binding to nvim_buf_line_count.

Returns the number of lines in the given buffer.

Binding to nvim_buf_set_keymap.

Sets a buffer-local mapping for the given mode. To set a global mapping use api::set_keymap instead.

Binding to nvim_buf_set_lines.

Sets (replaces) a line-range in the buffer. Indexing is zero-based, end-exclusive.

Binding to nvim_buf_set_mark.

Sets a named mark in the buffer. Marks are (1,0)-indexed, and passing 0 as line deletes the mark.

Binding to nvim_buf_set_name.

Sets the full file name for a buffer.

Binding to nvim_buf_set_option.

Sets a buffer option value. Passing None as value deletes the option (only works if there’s a global fallback).

Binding to nvim_buf_set_text.

Sets (replaces) a range in the buffer. Indexing is zero-based, with both row and column indices being end-exclusive.

Binding to nvim_buf_set_var.

Sets a buffer-scoped (b:) variable.

Binding to nvim_buf_add_highlight.

Adds a highlight to the buffer. line, col_start and col_end are all 0-indexed. You can also pass -1 to col_end to highlight to end of line.

Binding to nvim_buf_clear_namespace.

Clears namespaced objects like highlights, extmarks, or virtual text from a region.

Lines are 0-indexed. It’s possible to clear the namespace in the entire buffer by specifying line_start = 0 and line_end = -1.

Binding to nvim_buf_del_extmark.

Removes an extmark from the buffer.

Binding to nvim_buf_get_extmark_by_id.

The first two elements of the returned tuple represent the 0-indexed row, col position of the extmark. The last element is only present if the details option field was set to true.

Bindings to nvim_buf_get_extmarks.

Gets all the extmarks in a buffer region specified by start and end positions. Returns an iterator over (extmark_id, row, col, infos) tuples in “traversal order”. Like for Buffer::get_extmark_by_id, the infos are present only if the details option field was set to true.

Binding to nvim_buf_set_extmark.

Creates or updates an extmark. Both line and col are 0-indexed. Returns the id of the created/updated extmark.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Deserialize this value from the given Serde deserializer. Read more

Formats the value using the given formatter. Read more

Converts to this type from the input type.

Converts to this type from the input type.

Converts to this type from the input type.

Feeds this value into the given Hasher. Read more

Feeds a slice of this type into the given Hasher. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

Uses borrowed data to replace owned data, usually by cloning. Read more

Converts the given value to a String. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.