1 """API for working with Nvim windows."""
2 from pynvim.api.common import Remote
10 """A remote Nvim window."""
12 _api_prefix = "nvim_win_"
16 """Get the `Buffer` currently being displayed by the window."""
17 return self.request('nvim_win_get_buf')
21 """Get the (row, col) tuple with the current cursor position."""
22 return self.request('nvim_win_get_cursor')
25 def cursor(self, pos):
26 """Set the (row, col) tuple as the new cursor position."""
27 return self.request('nvim_win_set_cursor', pos)
31 """Get the window height in rows."""
32 return self.request('nvim_win_get_height')
35 def height(self, height):
36 """Set the window height in rows."""
37 return self.request('nvim_win_set_height', height)
41 """Get the window width in rows."""
42 return self.request('nvim_win_get_width')
45 def width(self, width):
46 """Set the window height in rows."""
47 return self.request('nvim_win_set_width', width)
51 """0-indexed, on-screen window position(row) in display cells."""
52 return self.request('nvim_win_get_position')[0]
56 """0-indexed, on-screen window position(col) in display cells."""
57 return self.request('nvim_win_get_position')[1]
61 """Get the `Tabpage` that contains the window."""
62 return self.request('nvim_win_get_tabpage')
66 """Return True if the window still exists."""
67 return self.request('nvim_win_is_valid')
71 """Get the window number."""
72 return self.request('nvim_win_get_number')