Struct Window
pub struct Window(pub(crate) i32);Expand description
A wrapper around a Neovim window handle.
Tuple Fields§
§0: i32Implementations§
§impl Window
impl Window
pub fn get_option<Opt>(&self, name: &str) -> Result<Opt, Error>where
Opt: FromObject,
👎Deprecated since 0.5.0: use get_option_value instead
pub fn get_option<Opt>(&self, name: &str) -> Result<Opt, Error>where
Opt: FromObject,
get_option_value insteadBinding to nvim_win_get_option().
Gets a window option value.
pub fn set_option<Opt>(&mut self, name: &str, value: Opt) -> Result<(), Error>where
Opt: ToObject,
👎Deprecated since 0.5.0: use set_option_value instead
pub fn set_option<Opt>(&mut self, name: &str, value: Opt) -> Result<(), Error>where
Opt: ToObject,
set_option_value insteadBinding 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).
§impl Window
impl Window
pub 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.
pub 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.
§impl Window
impl Window
pub fn current() -> Window
pub fn current() -> Window
Shorthand for get_current_win.
pub fn call<F, Res, Ret>(&self, fun: F) -> Result<Ret, Error>where
F: FnOnce(()) -> Res + 'static,
Res: IntoResult<Ret>,
<Res as IntoResult<Ret>>::Error: Error + 'static,
Ret: Pushable + FromObject,
pub fn call<F, Res, Ret>(&self, fun: F) -> Result<Ret, Error>where
F: FnOnce(()) -> Res + 'static,
Res: IntoResult<Ret>,
<Res as IntoResult<Ret>>::Error: Error + 'static,
Ret: Pushable + FromObject,
Binding to nvim_win_call().
Calls a function with this window as the temporary current window.
pub 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.
pub 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.
pub 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.
pub 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.
pub 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.
pub 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.
pub 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.
pub 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.
pub 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.
pub 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.
pub 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.
pub fn is_valid(&self) -> bool
pub fn is_valid(&self) -> bool
Binding to nvim_win_is_valid().
Checks if the window is valid.
pub 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.
pub 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.
pub 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.
pub fn set_hl_ns(&mut self, ns_id: u32) -> Result<(), Error>
pub fn set_hl_ns(&mut self, ns_id: u32) -> Result<(), Error>
Binding to nvim_win_set_hl_ns().
Sets the highlight namespace for this window. This will the highlights
defined with set_hl for the given namespace, but
fall back to global highlights (ns_id = 0) if those are missing.
This takes precedence over the winhighlight option.
pub fn set_var<Var>(&mut self, name: &str, value: Var) -> Result<(), Error>where
Var: ToObject,
pub fn set_var<Var>(&mut self, name: &str, value: Var) -> Result<(), Error>where
Var: ToObject,
Binding to nvim_win_set_var().
Sets a window-scoped (w:) variable.
pub fn set_width(&mut self, width: u32) -> Result<(), Error>
pub fn set_width(&mut self, width: u32) -> Result<(), Error>
Binding to nvim_win_set_width().
Sets the window width.
pub fn text_height(
&self,
opts: &WinTextHeightOpts,
) -> Result<WinTextHeightInfos, Error>
pub fn text_height( &self, opts: &WinTextHeightOpts, ) -> Result<WinTextHeightInfos, Error>
Binding to nvim_win_text_height().
Computes the number of screen lines occupied by a range of text in a given window. Works for off-screen text and takes folds into account.
Trait Implementations§
§impl<'de> Deserialize<'de> for Window
impl<'de> Deserialize<'de> for Window
§fn deserialize<__D>(
__deserializer: __D,
) -> Result<Window, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<Window, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
§impl FromObject for Window
impl FromObject for Window
§impl Serialize for Window
impl Serialize for Window
§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
impl Eq for Window
impl StructuralPartialEq for Window
Auto Trait Implementations§
impl Freeze for Window
impl RefUnwindSafe for Window
impl Send for Window
impl Sync for Window
impl Unpin for Window
impl UnwindSafe for Window
Blanket Implementations§
§impl<T> AnySync for T
impl<T> AnySync for T
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more§impl<T> IntoResult<T> for T
impl<T> IntoResult<T> for T
§type Error = Infallible
type Error = Infallible
Result.§fn into_result(self) -> Result<T, <T as IntoResult<T>>::Error>
fn into_result(self) -> Result<T, <T as IntoResult<T>>::Error>
Result.§impl<D> OwoColorize for D
impl<D> OwoColorize for D
§fn fg<C>(&self) -> FgColorDisplay<'_, C, Self>where
C: Color,
fn fg<C>(&self) -> FgColorDisplay<'_, C, Self>where
C: Color,
§fn bg<C>(&self) -> BgColorDisplay<'_, C, Self>where
C: Color,
fn bg<C>(&self) -> BgColorDisplay<'_, C, Self>where
C: Color,
§fn on_magenta(&self) -> BgColorDisplay<'_, Magenta, Self>
fn on_magenta(&self) -> BgColorDisplay<'_, Magenta, Self>
§fn default_color(&self) -> FgColorDisplay<'_, Default, Self>
fn default_color(&self) -> FgColorDisplay<'_, Default, Self>
§fn on_default_color(&self) -> BgColorDisplay<'_, Default, Self>
fn on_default_color(&self) -> BgColorDisplay<'_, Default, Self>
§fn bright_black(&self) -> FgColorDisplay<'_, BrightBlack, Self>
fn bright_black(&self) -> FgColorDisplay<'_, BrightBlack, Self>
§fn on_bright_black(&self) -> BgColorDisplay<'_, BrightBlack, Self>
fn on_bright_black(&self) -> BgColorDisplay<'_, BrightBlack, Self>
§fn bright_red(&self) -> FgColorDisplay<'_, BrightRed, Self>
fn bright_red(&self) -> FgColorDisplay<'_, BrightRed, Self>
§fn on_bright_red(&self) -> BgColorDisplay<'_, BrightRed, Self>
fn on_bright_red(&self) -> BgColorDisplay<'_, BrightRed, Self>
§fn bright_green(&self) -> FgColorDisplay<'_, BrightGreen, Self>
fn bright_green(&self) -> FgColorDisplay<'_, BrightGreen, Self>
§fn on_bright_green(&self) -> BgColorDisplay<'_, BrightGreen, Self>
fn on_bright_green(&self) -> BgColorDisplay<'_, BrightGreen, Self>
§fn bright_yellow(&self) -> FgColorDisplay<'_, BrightYellow, Self>
fn bright_yellow(&self) -> FgColorDisplay<'_, BrightYellow, Self>
§fn on_bright_yellow(&self) -> BgColorDisplay<'_, BrightYellow, Self>
fn on_bright_yellow(&self) -> BgColorDisplay<'_, BrightYellow, Self>
§fn bright_blue(&self) -> FgColorDisplay<'_, BrightBlue, Self>
fn bright_blue(&self) -> FgColorDisplay<'_, BrightBlue, Self>
§fn on_bright_blue(&self) -> BgColorDisplay<'_, BrightBlue, Self>
fn on_bright_blue(&self) -> BgColorDisplay<'_, BrightBlue, Self>
§fn bright_magenta(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
fn bright_magenta(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
§fn on_bright_magenta(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
fn on_bright_magenta(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
§fn bright_purple(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
fn bright_purple(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
§fn on_bright_purple(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
fn on_bright_purple(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
§fn bright_cyan(&self) -> FgColorDisplay<'_, BrightCyan, Self>
fn bright_cyan(&self) -> FgColorDisplay<'_, BrightCyan, Self>
§fn on_bright_cyan(&self) -> BgColorDisplay<'_, BrightCyan, Self>
fn on_bright_cyan(&self) -> BgColorDisplay<'_, BrightCyan, Self>
§fn bright_white(&self) -> FgColorDisplay<'_, BrightWhite, Self>
fn bright_white(&self) -> FgColorDisplay<'_, BrightWhite, Self>
§fn on_bright_white(&self) -> BgColorDisplay<'_, BrightWhite, Self>
fn on_bright_white(&self) -> BgColorDisplay<'_, BrightWhite, Self>
§fn blink_fast(&self) -> BlinkFastDisplay<'_, Self>
fn blink_fast(&self) -> BlinkFastDisplay<'_, Self>
§fn strikethrough(&self) -> StrikeThroughDisplay<'_, Self>
fn strikethrough(&self) -> StrikeThroughDisplay<'_, Self>
§fn color<Color>(&self, color: Color) -> FgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
fn color<Color>(&self, color: Color) -> FgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
OwoColorize::fg] or
a color-specific method, such as [OwoColorize::green], Read more§fn on_color<Color>(&self, color: Color) -> BgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
fn on_color<Color>(&self, color: Color) -> BgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
OwoColorize::bg] or
a color-specific method, such as [OwoColorize::on_yellow], Read more