Home Explore Blog CI



neovim

34th chunk of `runtime/doc/api.txt`
cc59478f29a68ff40b5c7d49250f59c0ac12dc262dd061ca0000000100000fd1
 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})                          *nvim_buf_line_count()*
    Returns the number of lines in the given buffer.

    Attributes: ~
        Since: 0.1.0

    Parameters: ~
      • {buffer}  Buffer id, or 0 for current buffer

    Return: ~
        Line count, or 0 for unloaded buffer. |api-buffer|

                                                       *nvim_buf_set_keymap()*
nvim_buf_set_keymap({buffer}, {mode}, {lhs}, {rhs}, {opts})
    Sets a buffer-local |mapping| for the given mode.

    Attributes: ~
        Since: 0.4.0

    Parameters: ~
      • {buffer}  Buffer id, or 0 for current buffer

    See also: ~
      • |nvim_set_keymap()|

                                                        *nvim_buf_set_lines()*
nvim_buf_set_lines({buffer}, {start}, {end}, {strict_indexing}, {replacement})
    Sets (replaces) a line-range in the buffer.

    Indexing is zero-based, end-exclusive. Negative indices are interpreted as
    length+1+index: -1 refers to the index past the end. So to change or
    delete the last line use start=-2 and end=-1.

    To insert lines at a given index, set `start` and `end` to the same index.
    To delete a range of lines, set `replacement` to an empty array.

    Out-of-bounds indices are clamped to the nearest valid value, unless
    `strict_indexing` is set.

    Attributes: ~
        not allowed when |textlock| is active
        Since: 0.1.0

    Parameters: ~
      • {buffer}           Buffer id, or 0 for current buffer
      • {start}            First line index
      • {end}              Last line index, exclusive
      • {strict_indexing}  Whether out-of-bounds should be an error.
      • {replacement}      Array of lines to use as replacement

    See also: ~
      • |nvim_buf_set_text()|

                                                         *nvim_buf_set_mark()*
nvim_buf_set_mark({buffer}, {name}, {line}, {col}, {opts})
    Sets a named mark in the given buffer, all marks are allowed
    file/uppercase, visual, last change, etc. See |mark-motions|.

    Marks are (1,0)-indexed. |api-indexing|

    Note: ~
      • Passing 0 as line deletes the mark

    Attributes: ~
        Since: 0.6.0

    Parameters: ~
      • {buffer}  Buffer to set the mark on
      • {name}    Mark name
      • {line}    Line number
      • {col}     Column/row number
      • {opts}    Optional parameters. Reserved for future use.

    Return: ~
        true if the mark was set, else false.

    See also: ~
      • |nvim_buf_del_mark()|
      • |nvim_buf_get_mark()|

nvim_buf_set_name({buffer}, {name})                      *nvim_buf_set_name()*
    Sets the full file name for a buffer, like |:file_f|

    Attributes: ~
        Since: 0.1.0

    Parameters: ~
      • {buffer}  Buffer id, or 0 for current buffer
      • {name}    Buffer name

                                                         *nvim_buf_set_text()*
nvim_buf_set_text({buffer}, {start_row}, {start_col}, {end_row}, {end_col},
                  {replacement})
    Sets (replaces) a range in

Title: nvim_buf_is_loaded, nvim_buf_is_valid, nvim_buf_line_count, nvim_buf_set_keymap, nvim_buf_set_lines, nvim_buf_set_mark, nvim_buf_set_name, nvim_buf_set_text: Buffer API Functions
Summary
This section describes Neovim buffer API functions. `nvim_buf_is_loaded` checks if a buffer is valid and loaded. `nvim_buf_is_valid` checks if a buffer is valid. `nvim_buf_line_count` returns the number of lines in a buffer. `nvim_buf_set_keymap` sets a buffer-local mapping. `nvim_buf_set_lines` replaces a range of lines in the buffer. `nvim_buf_set_mark` sets a named mark in the buffer. `nvim_buf_set_name` sets the full file name for a buffer. `nvim_buf_set_text` sets a range of text in a buffer.