Home Explore Blog CI



neovim

42th chunk of `runtime/doc/api.txt`
3bef27646b30c5685372ae838b23418048649aac33c5d57f0000000100000fc8
 Namespace
      • {opts}   Optional parameters to set:
                 • wins: a list of windows to be scoped in


==============================================================================
Window Functions                                                  *api-window*

nvim_win_call({window}, {fun})                               *nvim_win_call()*
    Calls a function with window as temporary current window.

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

    Parameters: ~
      • {window}  |window-ID|, or 0 for current window
      • {fun}     Function to call inside the window (currently Lua callable
                  only)

    Return: ~
        Return value of function.

    See also: ~
      • |win_execute()|
      • |nvim_buf_call()|

nvim_win_close({window}, {force})                           *nvim_win_close()*
    Closes the window (like |:close| with a |window-ID|).

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

    Parameters: ~
      • {window}  |window-ID|, or 0 for current window
      • {force}   Behave like `:close!` The last window of a buffer with
                  unwritten changes can be closed. The buffer will become
                  hidden, even if 'hidden' is not set.

nvim_win_del_var({window}, {name})                        *nvim_win_del_var()*
    Removes a window-scoped (w:) variable

    Attributes: ~
        Since: 0.1.0

    Parameters: ~
      • {window}  |window-ID|, or 0 for current window
      • {name}    Variable name

nvim_win_get_buf({window})                                *nvim_win_get_buf()*
    Gets the current buffer in a window

    Attributes: ~
        Since: 0.1.0

    Parameters: ~
      • {window}  |window-ID|, or 0 for current window

    Return: ~
        Buffer id

nvim_win_get_cursor({window})                          *nvim_win_get_cursor()*
    Gets the (1,0)-indexed, buffer-relative cursor position for a given window
    (different windows showing the same buffer have independent cursor
    positions). |api-indexing|

    Attributes: ~
        Since: 0.1.0

    Parameters: ~
      • {window}  |window-ID|, or 0 for current window

    Return: ~
        (row, col) tuple

    See also: ~
      • |getcurpos()|

nvim_win_get_height({window})                          *nvim_win_get_height()*
    Gets the window height

    Attributes: ~
        Since: 0.1.0

    Parameters: ~
      • {window}  |window-ID|, or 0 for current window

    Return: ~
        Height as a count of rows

nvim_win_get_number({window})                          *nvim_win_get_number()*
    Gets the window number

    Attributes: ~
        Since: 0.1.0

    Parameters: ~
      • {window}  |window-ID|, or 0 for current window

    Return: ~
        Window number

nvim_win_get_position({window})                      *nvim_win_get_position()*
    Gets the window position in display cells. First position is zero.

    Attributes: ~
        Since: 0.1.0

    Parameters: ~
      • {window}  |window-ID|, or 0 for current window

    Return: ~
        (row, col) tuple with the window position

nvim_win_get_tabpage({window})                        *nvim_win_get_tabpage()*
    Gets the window tabpage

    Attributes: ~
        Since: 0.1.0

    Parameters: ~
      • {window}  |window-ID|, or 0 for current window

    Return: ~
        Tabpage that contains the window

nvim_win_get_var({window}, {name})                        *nvim_win_get_var()*
    Gets a window-scoped (w:) variable

    Attributes: ~
        Since: 0.1.0

    Parameters: ~
      • {window}  |window-ID|, or 0 for current window
      • {name}    Variable name

    Return: ~
        Variable value

nvim_win_get_width({window})                            *nvim_win_get_width()*
    Gets the window width

    Attributes: ~
        Since: 0.1.0

    Parameters: ~
      • {window}  |window-ID|, or 0 for current window

    Return: ~
        Width as a count of columns

nvim_win_hide({window})  

Title: Neovim Window Functions (Continued)
Summary
This section details various Neovim API functions for window management. It covers `nvim_win_call` to execute a function within a specific window, `nvim_win_close` to close a window, `nvim_win_del_var` to remove a window-scoped variable, `nvim_win_get_buf` to retrieve the buffer associated with a window, `nvim_win_get_cursor` to get the cursor position in a window, `nvim_win_get_height` and `nvim_win_get_width` to get window dimensions, `nvim_win_get_number` to get the window number, `nvim_win_get_position` to get window position, `nvim_win_get_tabpage` to get window's tabpage and `nvim_win_get_var` to retrieve window-scoped variables. Finally it introduces `nvim_win_hide` to hide the window.