Module vpe.windows

Window specific support.

This provides support for working with Vim window layouts. The intended way to use this is to use LayoutElement.create_from_vim_layout. For example:

layout = LayoutElement.create_from_vim_layout(vim.winlayout())

The returned value will be a LayoutRow, LayoutColumn or LayoutWindow window instance. Use the type_name class attribute when it is necessary to know the actual type.

LayoutColumn

class vpe.windows.LayoutColumn(elements: List)

Details of a column in a window layout.

Parameters

row

A list of Vim row or leaf specs.

Properties

property width

The width of this column.

Methods

adjust_width(tot_width: int)

Adjust widths of children to match a new total width.

LayoutElement

class vpe.windows.LayoutElement(elements: List)

An element in a window layout.

Each element is either a LayoutRow, LayoutColumn or a LayoutWindow.

Attributes

type_name

A class attribute used to identify the type of element.

Methods

apply_sizes()

Apply this layout’s sizes to the actual Vim window layout.

describe(level=0)

Generate a description as a sequence of lines.

The description is intended to be user friendly. It is best not to rely on its format because it may change in future releases.

iter_windows()

Iterate throught the leaf windows.

set_widths_from_layout(layout: LayoutElement)

Update the widths using another layour element.

Parameters

layout: LayoutElement

The LayoutElement to copy from.

Class methods

classmethod create_from_vim_layout(layout)

Create LayoutElement from the result of a winlayout() call.

LayoutRow

class vpe.windows.LayoutRow(elements: List)

Details of a row in a window layout.

Parameters

row

A list of Vim column or leaf specs.

Properties

property width

The width of this row.

Methods

adjust_width(tot_width: int)

Adjust widths of children to match a new total width.

LayoutWindow

class vpe.windows.LayoutWindow(win_id: int)

Details of a window in a window layout.

Parameters

wid

The unique ID of the window.

Properties

property width

The width of this window.

Methods

adjust_width(tot_width: int)

Adjust width of this window.

describe(level=0)

Generate a description as a sequence of lines.