Home Explore Blog CI



neovim

45th chunk of `runtime/doc/api.txt`
c91d2da9224a9bcf2b817393e74972ce67bf3d007b4f3d6b0000000100000fbc
 returned height is reached (first row
          of a closed fold).
        • end_vcol: Ending virtual column in "end_row" where "max_height" or
          the returned height is reached. 0 if "end_row" is a closed fold.

    See also: ~
      • |virtcol()| for text width.


==============================================================================
Win_config Functions                                          *api-win_config*

nvim_open_win({buffer}, {enter}, {config})                   *nvim_open_win()*
    Opens a new split window, or a floating window if `relative` is specified,
    or an external window (managed by the UI) if `external` is specified.

    Floats are windows that are drawn above the split layout, at some anchor
    position in some other window. Floats can be drawn internally or by
    external GUI with the |ui-multigrid| extension. External windows are only
    supported with multigrid GUIs, and are displayed as separate top-level
    windows.

    For a general overview of floats, see |api-floatwin|.

    The `width` and `height` of the new window must be specified when opening
    a floating window, but are optional for normal windows.

    If `relative` and `external` are omitted, a normal "split" window is
    created. The `win` property determines which window will be split. If no
    `win` is provided or `win == 0`, a window will be created adjacent to the
    current window. If -1 is provided, a top-level split will be created.
    `vertical` and `split` are only valid for normal windows, and are used to
    control split direction. For `vertical`, the exact direction is determined
    by |'splitright'| and |'splitbelow'|. Split windows cannot have
    `bufpos`/`row`/`col`/`border`/`title`/`footer` properties.

    With relative=editor (row=0,col=0) refers to the top-left corner of the
    screen-grid and (row=Lines-1,col=Columns-1) refers to the bottom-right
    corner. Fractional values are allowed, but the builtin implementation
    (used by non-multigrid UIs) will always round down to nearest integer.

    Out-of-bounds values, and configurations that make the float not fit
    inside the main editor, are allowed. The builtin implementation truncates
    values so floats are fully within the main screen grid. External GUIs
    could let floats hover outside of the main window like a tooltip, but this
    should not be used to specify arbitrary WM screen positions.

    Example (Lua): window-relative float >lua
        vim.api.nvim_open_win(0, false,
          {relative='win', row=3, col=3, width=12, height=3})
<

    Example (Lua): buffer-relative float (travels as buffer is scrolled) >lua
        vim.api.nvim_open_win(0, false,
          {relative='win', width=12, height=3, bufpos={100,10}})
<

    Example (Lua): vertical split left of the current window >lua
        vim.api.nvim_open_win(0, false, {
          split = 'left',
          win = 0
        })
<

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

    Parameters: ~
      • {buffer}  Buffer to display, or 0 for current buffer
      • {enter}   Enter the window (make it the current window)
      • {config}  Map defining the window configuration. Keys:
                  • relative: Sets the window layout to "floating", placed at
                    (row,col) coordinates relative to:
                    • "cursor" Cursor position in current window.
                    • "editor" The global editor grid.
                    • "laststatus" 'laststatus' if present, or last row.
                    • "mouse" Mouse position.
                    • "tabline" Tabline if present, or first row.
                    • "win" Window given by the `win` field, or current
                      window.
                  • win: |window-ID| window to split, or relative window when
                    creating a float (relative="win").
                  • anchor: Decides which corner of the float to place at
              

Title: Neovim Window Configuration: Opening Windows and Float Details
Summary
This section delves deeper into the `nvim_open_win` function, explaining how to open different types of windows (split, floating, and external). It details the configurations needed for floating windows, including relative positioning, dimensions, and limitations. It also provides examples of how to create different types of windows using Lua.