#include <assert.h>
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
#include "nvim/api/private/defs.h"
#include "nvim/api/private/helpers.h"
#include "nvim/api/win_config.h"
#include "nvim/ascii.h"
#include "nvim/highlight_group.h"
#include "nvim/option.h"
#include "nvim/screen.h"
#include "nvim/strings.h"
#include "nvim/syntax.h"
#include "nvim/ui.h"
#include "nvim/window.h"
Functions | |
Window | nvim_open_win (Buffer buffer, Boolean enter, Dict(float_config) *config, Error *err) FUNC_API_CHECK_TEXTLOCK |
void | nvim_win_set_config (Window window, Dict(float_config) *config, Error *err) FUNC_API_SINCE(6) |
Dictionary | nvim_win_get_config (Window window, Error *err) FUNC_API_SINCE(6) |
Open a new window.
Currently this is used to open floating and external windows. 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|.
Exactly one of external
and relative
must be specified. The width
and height
of the new window must be specified.
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
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)
vim.api.nvim_open_win(0, false, {relative='win', width=12, height=3, bufpos={100,10}})
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:
| |
[out] | err | Error details, if any |
Dictionary nvim_win_get_config | ( | Window | window, |
Error * | err | ||
) |
Gets window configuration.
The returned value may be given to |nvim_open_win()|.
relative
is empty for normal windows.
window | Window handle, or 0 for current window | |
[out] | err | Error details, if any |
Configures window layout. Currently only for floating and external windows (including changing a split window to those layouts).
When reconfiguring a floating window, absent option keys will not be changed. row
/col
and relative
must be reconfigured together.
window | Window handle, or 0 for current window | |
config | Map defining the window configuration, see |nvim_open_win()| | |
[out] | err | Error details, if any |