Functions
window.c File Reference
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#include <limits.h>
#include "nvim/api/window.h"
#include "nvim/api/private/defs.h"
#include "nvim/api/private/helpers.h"
#include "nvim/ex_docmd.h"
#include "nvim/vim.h"
#include "nvim/buffer.h"
#include "nvim/cursor.h"
#include "nvim/window.h"
#include "nvim/screen.h"
#include "nvim/move.h"

Functions

Buffer nvim_win_get_buf (Window window, Error *err) FUNC_API_SINCE(1)
 
void nvim_win_set_buf (Window window, Buffer buffer, Error *err) FUNC_API_SINCE(5)
 
 ArrayOf (Integer, 2)
 
void nvim_win_set_cursor (Window window, ArrayOf(Integer, 2) pos, Error *err) FUNC_API_SINCE(1)
 
Integer nvim_win_get_height (Window window, Error *err) FUNC_API_SINCE(1)
 
void nvim_win_set_height (Window window, Integer height, Error *err) FUNC_API_SINCE(1)
 
Integer nvim_win_get_width (Window window, Error *err) FUNC_API_SINCE(1)
 
void nvim_win_set_width (Window window, Integer width, Error *err) FUNC_API_SINCE(1)
 
Object nvim_win_get_var (Window window, String name, Error *err) FUNC_API_SINCE(1)
 
void nvim_win_set_var (Window window, String name, Object value, Error *err) FUNC_API_SINCE(1)
 
void nvim_win_del_var (Window window, String name, Error *err) FUNC_API_SINCE(1)
 
Object window_set_var (Window window, String name, Object value, Error *err)
 
Object window_del_var (Window window, String name, Error *err)
 
Object nvim_win_get_option (Window window, String name, Error *err) FUNC_API_SINCE(1)
 
void nvim_win_set_option (uint64_t channel_id, Window window, String name, Object value, Error *err) FUNC_API_SINCE(1)
 
Tabpage nvim_win_get_tabpage (Window window, Error *err) FUNC_API_SINCE(1)
 
Integer nvim_win_get_number (Window window, Error *err) FUNC_API_SINCE(1)
 
Boolean nvim_win_is_valid (Window window) FUNC_API_SINCE(1)
 
void nvim_win_set_config (Window window, Dictionary config, Error *err) FUNC_API_SINCE(6)
 
Dictionary nvim_win_get_config (Window window, Error *err) FUNC_API_SINCE(6)
 
void nvim_win_close (Window window, Boolean force, Error *err) FUNC_API_SINCE(6)
 

Function Documentation

ArrayOf ( Integer  ,
 
)

Gets the cursor position in the window

Parameters
windowWindow handle
[out]errError details, if any
Returns
(row, col) tuple

Gets the window position in display cells. First position is zero.

Parameters
windowWindow handle
[out]errError details, if any
Returns
(row, col) tuple with the window position
void nvim_win_close ( Window  window,
Boolean  force,
Error err 
)

Close a window.

This is equivalent to |:close| with count except that it takes a window id.

Parameters
windowWindow handle
forceBehave 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.
[out]errError details, if any
Returns
Window number
void nvim_win_del_var ( Window  window,
String  name,
Error err 
)

Removes a window-scoped (w:) variable

Parameters
windowWindow handle
nameVariable name
[out]errError details, if any
Buffer nvim_win_get_buf ( Window  window,
Error err 
)

Gets the current buffer in a window

Parameters
windowWindow handle
[out]errError details, if any
Returns
Buffer handle
Dictionary nvim_win_get_config ( Window  window,
Error err 
)

Return window configuration.

Return a dictionary containing the same config that can be given to |nvim_open_win()|.

relative will be an empty string for normal windows.

Parameters
windowWindow handle
[out]errError details, if any
Returns
Window configuration
Integer nvim_win_get_height ( Window  window,
Error err 
)

Gets the window height

Parameters
windowWindow handle
[out]errError details, if any
Returns
Height as a count of rows
Integer nvim_win_get_number ( Window  window,
Error err 
)

Gets the window number

Parameters
windowWindow handle
[out]errError details, if any
Returns
Window number
Object nvim_win_get_option ( Window  window,
String  name,
Error err 
)

Gets a window option value

Parameters
windowWindow handle
nameOption name
[out]errError details, if any
Returns
Option value
Tabpage nvim_win_get_tabpage ( Window  window,
Error err 
)

Gets the window tabpage

Parameters
windowWindow handle
[out]errError details, if any
Returns
Tabpage that contains the window
Object nvim_win_get_var ( Window  window,
String  name,
Error err 
)

Gets a window-scoped (w:) variable

Parameters
windowWindow handle
nameVariable name
[out]errError details, if any
Returns
Variable value
Integer nvim_win_get_width ( Window  window,
Error err 
)

Gets the window width

Parameters
windowWindow handle
[out]errError details, if any
Returns
Width as a count of columns
Boolean nvim_win_is_valid ( Window  window)

Checks if a window is valid

Parameters
windowWindow handle
Returns
true if the window is valid, false otherwise
void nvim_win_set_buf ( Window  window,
Buffer  buffer,
Error err 
)

Sets the current buffer in a window, without side-effects

Parameters
windowWindow handle
bufferBuffer handle
[out]errError details, if any
void nvim_win_set_config ( Window  window,
Dictionary  config,
Error err 
)

Configure window position. Currently this is only used to configure floating and external windows (including changing a split window to these types).

See documentation at |nvim_open_win()|, for the meaning of parameters.

When reconfiguring a floating window, absent option keys will not be changed. The following restriction apply: row, col and relative must be reconfigured together. Only changing a subset of these is an error.

Parameters
windowWindow handle
configDictionary of window configuration
[out]errError details, if any
void nvim_win_set_cursor ( Window  window,
ArrayOf(Integer, 2)  pos,
Error err 
)

Sets the cursor position in the window

Parameters
windowWindow handle
pos(row, col) tuple representing the new position
[out]errError details, if any
void nvim_win_set_height ( Window  window,
Integer  height,
Error err 
)

Sets the window height. This will only succeed if the screen is split horizontally.

Parameters
windowWindow handle
heightHeight as a count of rows
[out]errError details, if any
void nvim_win_set_option ( uint64_t  channel_id,
Window  window,
String  name,
Object  value,
Error err 
)

Sets a window option value. Passing 'nil' as value deletes the option(only works if there's a global fallback)

Parameters
windowWindow handle
nameOption name
valueOption value
[out]errError details, if any
void nvim_win_set_var ( Window  window,
String  name,
Object  value,
Error err 
)

Sets a window-scoped (w:) variable

Parameters
windowWindow handle
nameVariable name
valueVariable value
[out]errError details, if any
void nvim_win_set_width ( Window  window,
Integer  width,
Error err 
)

Sets the window width. This will only succeed if the screen is split vertically.

Parameters
windowWindow handle
widthWidth as a count of columns
[out]errError details, if any
Object window_del_var ( Window  window,
String  name,
Error err 
)

Removes a window-scoped (w:) variable

Deprecated:
Parameters
windowWindow handle
namevariable name
[out]errError details, if any
Returns
Old value
Object window_set_var ( Window  window,
String  name,
Object  value,
Error err 
)

Sets a window-scoped (w:) variable

Deprecated:
Parameters
windowWindow handle
nameVariable name
valueVariable value
[out]errError details, if any
Returns
Old value or nil if there was no previous value.
    @warning It may return nil if there was no previous value
             or if previous value was `v:null`.