Functions
window.c File Reference
#include <limits.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#include "nvim/api/private/defs.h"
#include "nvim/api/private/helpers.h"
#include "nvim/api/window.h"
#include "nvim/ascii.h"
#include "nvim/buffer.h"
#include "nvim/cursor.h"
#include "nvim/ex_docmd.h"
#include "nvim/globals.h"
#include "nvim/lua/executor.h"
#include "nvim/move.h"
#include "nvim/option.h"
#include "nvim/screen.h"
#include "nvim/syntax.h"
#include "nvim/vim.h"
#include "nvim/window.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_CHECK_TEXTLOCK
 
 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 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_hide (Window window, Error *err) FUNC_API_CHECK_TEXTLOCK
 
void nvim_win_close (Window window, Boolean force, Error *err) FUNC_API_CHECK_TEXTLOCK
 
Object nvim_win_call (Window window, LuaRef fun, Error *err) FUNC_API_LUA_ONLY
 

Function Documentation

◆ ArrayOf()

ArrayOf ( Integer  ,
 
)

Gets the (1,0)-indexed cursor position in the window. |api-indexing|

Parameters
windowWindow handle, or 0 for current window
[out]errError details, if any
Returns
(row, col) tuple

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

Parameters
windowWindow handle, or 0 for current window
[out]errError details, if any
Returns
(row, col) tuple with the window position

◆ nvim_win_call()

Object nvim_win_call ( Window  window,
LuaRef  fun,
Error err 
)

Calls a function with window as temporary current window.

See also
|win_execute()|
|nvim_buf_call()|
Parameters
windowWindow handle, or 0 for current window
funFunction to call inside the window (currently lua callable only)
[out]errError details, if any
Returns
Return value of function. NB: will deepcopy lua values currently, use upvalues to send lua references in and out.

◆ nvim_win_close()

void nvim_win_close ( Window  window,
Boolean  force,
Error err 
)

Closes the window (like |:close| with a |window-ID|).

Parameters
windowWindow handle, or 0 for current window
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

◆ nvim_win_del_var()

void nvim_win_del_var ( Window  window,
String  name,
Error err 
)

Removes a window-scoped (w:) variable

Parameters
windowWindow handle, or 0 for current window
nameVariable name
[out]errError details, if any

◆ nvim_win_get_buf()

Buffer nvim_win_get_buf ( Window  window,
Error err 
)

Gets the current buffer in a window

Parameters
windowWindow handle, or 0 for current window
[out]errError details, if any
Returns
Buffer handle

◆ nvim_win_get_height()

Integer nvim_win_get_height ( Window  window,
Error err 
)

Gets the window height

Parameters
windowWindow handle, or 0 for current window
[out]errError details, if any
Returns
Height as a count of rows

◆ nvim_win_get_number()

Integer nvim_win_get_number ( Window  window,
Error err 
)

Gets the window number

Parameters
windowWindow handle, or 0 for current window
[out]errError details, if any
Returns
Window number

◆ nvim_win_get_option()

Object nvim_win_get_option ( Window  window,
String  name,
Error err 
)

Gets a window option value

Parameters
windowWindow handle, or 0 for current window
nameOption name
[out]errError details, if any
Returns
Option value

◆ nvim_win_get_tabpage()

Tabpage nvim_win_get_tabpage ( Window  window,
Error err 
)

Gets the window tabpage

Parameters
windowWindow handle, or 0 for current window
[out]errError details, if any
Returns
Tabpage that contains the window

◆ nvim_win_get_var()

Object nvim_win_get_var ( Window  window,
String  name,
Error err 
)

Gets a window-scoped (w:) variable

Parameters
windowWindow handle, or 0 for current window
nameVariable name
[out]errError details, if any
Returns
Variable value

◆ nvim_win_get_width()

Integer nvim_win_get_width ( Window  window,
Error err 
)

Gets the window width

Parameters
windowWindow handle, or 0 for current window
[out]errError details, if any
Returns
Width as a count of columns

◆ nvim_win_hide()

void nvim_win_hide ( Window  window,
Error err 
)

Closes the window and hide the buffer it contains (like |:hide| with a |window-ID|).

Like |:hide| the buffer becomes hidden unless another window is editing it, or 'bufhidden' is unload, delete or wipe as opposed to |:close| or |nvim_win_close|, which will close the buffer.

Parameters
windowWindow handle, or 0 for current window
[out]errError details, if any

◆ nvim_win_is_valid()

Boolean nvim_win_is_valid ( Window  window)

Checks if a window is valid

Parameters
windowWindow handle, or 0 for current window
Returns
true if the window is valid, false otherwise

◆ nvim_win_set_buf()

void nvim_win_set_buf ( Window  window,
Buffer  buffer,
Error err 
)

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

Parameters
windowWindow handle, or 0 for current window
bufferBuffer handle
[out]errError details, if any

◆ nvim_win_set_cursor()

void nvim_win_set_cursor ( Window  window,
ArrayOf(Integer, 2)  pos,
Error err 
)

Sets the (1,0)-indexed cursor position in the window. |api-indexing|

Parameters
windowWindow handle, or 0 for current window
pos(row, col) tuple representing the new position
[out]errError details, if any

◆ nvim_win_set_height()

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, or 0 for current window
heightHeight as a count of rows
[out]errError details, if any

◆ nvim_win_set_option()

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
channel_id
windowWindow handle, or 0 for current window
nameOption name
valueOption value
[out]errError details, if any

◆ nvim_win_set_var()

void nvim_win_set_var ( Window  window,
String  name,
Object  value,
Error err 
)

Sets a window-scoped (w:) variable

Parameters
windowWindow handle, or 0 for current window
nameVariable name
valueVariable value
[out]errError details, if any

◆ nvim_win_set_width()

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, or 0 for current window
widthWidth as a count of columns
[out]errError details, if any