pub struct Window(/* private fields */);
Expand description
A wrapper around a Neovim window handle.
Implementations§
Source§impl Window
impl Window
Sourcepub fn get_config(&self) -> Result<WindowConfig, Error>
pub fn get_config(&self) -> Result<WindowConfig, Error>
Binding to nvim_win_get_config
.
Gets the window configuration.
Sourcepub fn set_config(&mut self, config: &WindowConfig) -> Result<(), Error>
pub fn set_config(&mut self, config: &WindowConfig) -> Result<(), Error>
Binding to nvim_win_get_config
.
Configures the window layout. Only for floating and external windows.
Source§impl Window
impl Window
Sourcepub fn current() -> Self
pub fn current() -> Self
Shorthand for get_current_win
.
Sourcepub fn call<R, F>(&self, fun: F) -> Result<R, Error>
pub fn call<R, F>(&self, fun: F) -> Result<R, Error>
Binding to nvim_win_call
.
Calls a function with this window as the temporary current window.
Sourcepub fn close(self, force: bool) -> Result<(), Error>
pub fn close(self, force: bool) -> Result<(), Error>
Binding to nvim_win_close
.
Closes the window. Not allowed when
textlock
is active.
Sourcepub fn del_var(&mut self, name: &str) -> Result<(), Error>
pub fn del_var(&mut self, name: &str) -> Result<(), Error>
Binding to nvim_win_del_var
.
Removes a window-scoped (w:
) variable.
Sourcepub fn get_buf(&self) -> Result<Buffer, Error>
pub fn get_buf(&self) -> Result<Buffer, Error>
Binding to nvim_win_get_buf
.
Gets the current Buffer
in the window.
Sourcepub fn get_cursor(&self) -> Result<(usize, usize), Error>
pub fn get_cursor(&self) -> Result<(usize, usize), Error>
Binding to nvim_win_get_cursor
.
Gets the (1,0)-indexed cursor position in the window.
Sourcepub fn get_height(&self) -> Result<u32, Error>
pub fn get_height(&self) -> Result<u32, Error>
Binding to nvim_win_get_height
.
Gets the window height as a count of rows.
Sourcepub fn get_number(&self) -> Result<u32, Error>
pub fn get_number(&self) -> Result<u32, Error>
Binding to nvim_win_get_number
.
Gets the window number.
Sourcepub fn get_option<Opt>(&self, name: &str) -> Result<Opt, Error>where
Opt: FromObject,
pub fn get_option<Opt>(&self, name: &str) -> Result<Opt, Error>where
Opt: FromObject,
Binding to nvim_win_get_option
.
Gets a window option value.
Sourcepub fn get_position(&self) -> Result<(usize, usize), Error>
pub fn get_position(&self) -> Result<(usize, usize), Error>
Binding to nvim_win_get_position
.
Gets the window position in display cells.
Sourcepub fn get_tabpage(&self) -> Result<TabPage, Error>
pub fn get_tabpage(&self) -> Result<TabPage, Error>
Binding to nvim_win_get_tabpage
.
Gets the window’s TabPage
.
Sourcepub fn get_var<Var>(&self, name: &str) -> Result<Var, Error>where
Var: FromObject,
pub fn get_var<Var>(&self, name: &str) -> Result<Var, Error>where
Var: FromObject,
Binding to nvim_win_get_var
.
Gets a window-scoped (w:
) variable.
Sourcepub fn get_width(&self) -> Result<u32, Error>
pub fn get_width(&self) -> Result<u32, Error>
Binding to nvim_win_get_width
.
Gets the window width as a number of columns.
Sourcepub fn hide(self) -> Result<(), Error>
pub fn hide(self) -> Result<(), Error>
Binding to nvim_win_hide
.
Closes the window and hides the buffer it contains.
Sourcepub fn is_valid(&self) -> bool
pub fn is_valid(&self) -> bool
Binding to nvim_win_is_valid
.
Checks if the window is valid.
Sourcepub fn set_buf(&mut self, buffer: &Buffer) -> Result<(), Error>
pub fn set_buf(&mut self, buffer: &Buffer) -> Result<(), Error>
Binding to nvim_win_set_buf
.
Sets buffer
as the current buffer in the window.
Sourcepub fn set_cursor(&mut self, line: usize, col: usize) -> Result<(), Error>
pub fn set_cursor(&mut self, line: usize, col: usize) -> Result<(), Error>
Binding to nvim_win_set_cursor
.
Sets the (1,0)-indexed cursor in the window. This will scroll the window even if it’s not the current one.
Sourcepub fn set_height(&mut self, height: u32) -> Result<(), Error>
pub fn set_height(&mut self, height: u32) -> Result<(), Error>
Binding to nvim_win_set_height
.
Sets the window height.
Sourcepub fn set_option<Opt>(&mut self, name: &str, value: Opt) -> Result<(), Error>where
Opt: ToObject,
pub fn set_option<Opt>(&mut self, name: &str, value: Opt) -> Result<(), Error>where
Opt: ToObject,
Binding to nvim_win_set_option
.
Sets a window option value. Passing None
as value deletes the option
(only works if there’s a global fallback).