Shell segments

class powerline.segments.shell.ShellCwdSegment[source]
powerline.segments.shell.continuation(renames={}, right_align=False, omit_cmdsubst=True)[source]

Display parser state.

Parameters:
  • omit_cmdsubst (bool) – Do not display cmdsubst parser state if it is the last one.

  • right_align (bool) – Align to the right.

  • renames (dict) – Rename states: {old_name : new_name}. If new_name is None then given state is not displayed.

Highlight groups used: continuation, continuation:current.

powerline.segments.shell.cwd()

Return the current working directory.

Returns a segment list to create a breadcrumb-like effect.

Parameters:
  • dir_shorten_len (int) – shorten parent directory names to this length (e.g. /long/path/to/powerline/l/p/t/powerline)

  • dir_limit_depth (int) – limit directory depth to this number (e.g. /long/path/to/powerline⋯/to/powerline)

  • use_path_separator (bool) – Use path separator in place of soft divider.

  • use_shortened_path (bool) – Use path from shortened_path --renderer-arg argument. If this argument is present shorten_home argument is ignored.

  • shorten_home (bool) – Shorten home directory to ~.

  • ellipsis (str) – Specifies what to use in place of omitted directories. Use None to not show this subsegment at all.

Divider highlight group used: cwd:divider.

Highlight groups used: cwd:current_folder or cwd. It is recommended to define all highlight groups.

powerline.segments.shell.jobnum(show_zero=False)[source]

Return the number of jobs.

Parameters:

show_zero (bool) – If False (default) shows nothing if there are no jobs. Otherwise shows zero for no jobs.

powerline.segments.shell.last_pipe_status(signal_names=True)[source]

Return last pipe status.

Parameters:

signal_names (bool) – If True (default), translate signal numbers to human-readable names.

Highlight groups used: exit_fail, exit_success

powerline.segments.shell.last_status(signal_names=True)[source]

Return last exit code.

Parameters:

signal_names (bool) – If True (default), translate signal numbers to human-readable names.

Highlight groups used: exit_fail

powerline.segments.shell.mode(default=None, override={'vicmd': 'COMMND', 'viins': 'INSERT'})[source]

Return the current mode.

Parameters:
  • override (dict) – dict for overriding mode strings.

  • default (str) – If current mode is equal to this string then this segment will not get displayed. If not specified the value is taken from $POWERLINE_DEFAULT_MODE variable. This variable is set by zsh bindings for any mode that does not start from vi.