Home Explore Blog CI



neovim

31th chunk of `runtime/doc/api.txt`
e45f7bf9c79268cc7c01050b2619bdcbb5f7c6663fd3ea280000000100000fdc
           • new end row of the changed text (offset from start
                           row)
                         • new end column of the changed text (if new end row
                           = 0, offset from start column)
                         • new end byte length of the changed text
                       • on_changedtick: Lua callback invoked on changedtick
                         increment without text change. Args:
                         • the string "changedtick"
                         • buffer id
                         • b:changedtick
                       • on_detach: Lua callback invoked on detach. Args:
                         • the string "detach"
                         • buffer id
                       • on_reload: Lua callback invoked on reload. The entire
                         buffer content should be considered changed. Args:
                         • the string "reload"
                         • buffer id
                       • utf_sizes: include UTF-32 and UTF-16 size of the
                         replaced region, as args to `on_lines`.
                       • preview: also attach to command preview (i.e.
                         'inccommand') events.

    Return: ~
        False if attach failed (invalid parameter, or buffer isn't loaded);
        otherwise True. TODO: LUA_API_NO_EVAL

    See also: ~
      • |nvim_buf_detach()|
      • |api-buffer-updates-lua|

nvim_buf_call({buffer}, {fun})                               *nvim_buf_call()*
    Call a function with buffer as temporary current buffer.

    This temporarily switches current buffer to "buffer". If the current
    window already shows "buffer", the window is not switched. If a window
    inside the current tabpage (including a float) already shows the buffer,
    then one of those windows will be set as current window temporarily.
    Otherwise a temporary scratch window (called the "autocmd window" for
    historical reasons) will be used.

    This is useful e.g. to call Vimscript functions that only work with the
    current buffer/window currently, like `jobstart(…, {'term': v:true})`.

    Attributes: ~
        Lua |vim.api| only
        Since: 0.5.0

    Parameters: ~
      • {buffer}  Buffer id, or 0 for current buffer
      • {fun}     Function to call inside the buffer (currently Lua callable
                  only)

    Return: ~
        Return value of function.

nvim_buf_del_keymap({buffer}, {mode}, {lhs})           *nvim_buf_del_keymap()*
    Unmaps 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_del_keymap()|

nvim_buf_del_mark({buffer}, {name})                      *nvim_buf_del_mark()*
    Deletes a named mark in the buffer. See |mark-motions|.

    Note: ~
      • only deletes marks set in the buffer, if the mark is not set in the
        buffer it will return false.

    Attributes: ~
        Since: 0.6.0

    Parameters: ~
      • {buffer}  Buffer to set the mark on
      • {name}    Mark name

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

    See also: ~
      • |nvim_buf_set_mark()|
      • |nvim_del_mark()|

nvim_buf_del_var({buffer}, {name})                        *nvim_buf_del_var()*
    Removes a buffer-scoped (b:) variable

    Attributes: ~
        Since: 0.1.0

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

nvim_buf_delete({buffer}, {opts})                          *nvim_buf_delete()*
    Deletes a buffer and its metadata (like |:bwipeout|).

    To get |:bdelete| behavior, reset 'buflisted' and pass `unload=true`: >lua
        vim.bo.buflisted = false
        vim.api.nvim_buf_delete(0, { unload = true })
<

    Attributes: ~
        not allowed when |textlock| is active or in the |cmdwin|
        Since: 0.5.0

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

Title: nvim_buf_call, nvim_buf_del_keymap, nvim_buf_del_mark, nvim_buf_del_var, nvim_buf_delete: Buffer API Functions
Summary
This section details several Neovim buffer API functions. `nvim_buf_call` allows executing a function within a specific buffer's context. `nvim_buf_del_keymap` unmaps buffer-local key mappings. `nvim_buf_del_mark` deletes named marks within a buffer. `nvim_buf_del_var` removes buffer-scoped variables. Finally, `nvim_buf_delete` deletes a buffer and its metadata, with options to mimic `:bdelete` behavior.