# Vim segments

class powerline.segments.vim.VimBranchSegment

class powerline.segments.vim.VimStashSegment

powerline.segments.vim.branch(ignore_statuses=(), status_colors=False)

  Return the current working branch.

  Parameters:

    - status_colors (bool) – Determines whether repository status will be used to determine highlighting. Default: False.

    - ignore_statuses (bool) – List of statuses which will not result in repo being marked as dirty. Most useful is setting this option to `["U"]`: this will ignore repository which has just untracked files (i.e. repository with modified, deleted or removed files will be marked as dirty, while just untracked files will make segment show clean repository). Only applicable if `status_colors` option is True.

  Highlight groups used: `branch_clean`, `branch_dirty`, `branch`.

  Divider highlight group used: `branch:divider`.

powerline.segments.vim.bufnr(show_current=True)

  Show buffer number

  Parameters:

    show_current (bool) – If False do not show current window number.

powerline.segments.vim.col_current()

  Return the current cursor column.

powerline.segments.vim.csv_col_current()

  Display CSV column number and column name

  Requires filetype to be set to `csv`.

  Parameters:

    - name (bool or str) – May be `True`, `False` and `"auto"`. In the first case value from the first raw will always be displayed. In the second case it will never be displayed. In the last case `csv.Sniffer().has_header()` will be used to detect whether current file contains header in the first column.

    - name_format (str) – String used to format column name (in case `display_name` is set to `True` or `"auto"`). Accepts `column_name` keyword argument.

  Highlight groups used: `csv:column_number` or `csv`, `csv:column_name` or `csv`.

powerline.segments.vim.file_bom(segment_info)

  Return BOM of the current file

  Returns:

    Byte order mark or None if unknown or missing BOM

  Divider highlight group used: `background:divider`.

powerline.segments.vim.file_directory(shorten_home=False, shorten_cwd=True, shorten_user=True, remove_scheme=True)

  Return file directory (head component of the file path).

  Parameters:

    - remove_scheme (bool) – Remove scheme part from the segment name, if present. See documentation of file_scheme segment for the description of what scheme is. Also removes the colon.

    - shorten_user (bool) – Shorten `$HOME` directory to `~/`. Does not work for files with scheme.

    - shorten_cwd (bool) – Shorten current directory to `./`. Does not work for files with scheme present.

    - shorten_home (bool) – Shorten all directories in `/home/` to `~user/` instead of `/home/user/`. Does not work for files with scheme present.

powerline.segments.vim.file_encoding(segment_info)

  Return file encoding/character set.

  Returns:

    file encoding/character set or None if unknown or missing file encoding

  Divider highlight group used: `background:divider`.

powerline.segments.vim.file_format(segment_info)

  Return file format (i.e. line ending type).

  Returns:

    file format or None if unknown or missing file format

  Divider highlight group used: `background:divider`.

powerline.segments.vim.file_name()

  Return file name (tail component of the file path).

  Parameters:

    - display_no_file (bool) – display a string if the buffer is missing a file name

    - no_file_text (str) – the string to display if the buffer is missing a file name

  Highlight groups used: `file_name_no_file` or `file_name`, `file_name`.

powerline.segments.vim.file_scheme()

  Return the protocol part of the file.

  Protocol is the part of the full filename just before the colon which starts with a latin letter and contains only latin letters, digits, plus, period or hyphen (refer to RFC3986 for the description of URI scheme). If there is no such a thing `None` is returned, effectively removing segment.

  Note

  Segment will not check whether there is `//` just after the colon or if there is at least one slash after the scheme. Reason: it is not always present. E.g. when opening file inside a zip archive file name will look like `zipfile:/path/to/archive.zip::file.txt`. `file_scheme` segment will catch `zipfile` part here.

powerline.segments.vim.file_size()

  Return file size in &encoding.

  Parameters:

    - suffix (str) – string appended to the file size

    - si_prefix (bool) – use SI prefix, e.g. MB instead of MiB

  Returns:

    file size or None if the file isn’t saved or if the size is too big to fit in a number

powerline.segments.vim.file_type(segment_info)

  Return file type.

  Returns:

    file type or None if unknown file type

  Divider highlight group used: `background:divider`.

powerline.segments.vim.file_vcs_status()

  Return the VCS status for this buffer.

  Highlight groups used: `file_vcs_status`.

powerline.segments.vim.line_count()

  Return the line count of the current buffer.

powerline.segments.vim.line_current()

  Return the current cursor line.

powerline.segments.vim.line_percent(gradient=False)

  Return the cursor position in the file as a percentage.

  Parameters:

    gradient (bool) – highlight the percentage with a color gradient (by default a green to red gradient)

  Highlight groups used: `line_percent_gradient` (gradient), `line_percent`.

powerline.segments.vim.mode(override=None)

  Return the current vim mode.

  If mode (returned by `mode()` VimL function, see `:h mode()` in Vim) consists of multiple characters and necessary mode is not known to powerline then it will fall back to mode with last character(s) ignored.

  Parameters:

    override (dict) – dict for overriding default mode strings, e.g. `{ 'n': 'NORM' }`

powerline.segments.vim.modified_buffers()

  Return a comma-separated list of modified buffers.

  Parameters:

    - text (str) – text to display before the modified buffer list

    - join_str (str) – string to use for joining the modified buffer list

powerline.segments.vim.modified_indicator()

  Return a file modified indicator.

  Parameters:

    text (string) – text to display if the current buffer is modified

powerline.segments.vim.paste_indicator()

  Return a paste mode indicator.

  Parameters:

    text (string) – text to display if paste mode is enabled

powerline.segments.vim.position(gradient=False, position_strings={'top': 'Top', 'bottom': 'Bot', 'all': 'All'})

  Return the position of the current view in the file as a percentage.

  Parameters:

    - position_strings (dict) – dict for translation of the position strings, e.g. `{"top":"Oben", "bottom":"Unten", "all":"Alles"}`

    - gradient (bool) – highlight the percentage with a color gradient (by default a green to red gradient)

  Highlight groups used: `position_gradient` (gradient), `position`.

powerline.segments.vim.readonly_indicator()

  Return a read-only indicator.

  Parameters:

    text (string) – text to display if the current buffer is read-only

powerline.segments.vim.stash()

  Return the number of stashes in the current working branch.

  Highlight groups used: `stash`.

powerline.segments.vim.tab(end=False)

  Mark start of the clickable region for tabpage

  Parameters:

    end (bool) – In place of starting region for the current tab end it.

  No highlight groups are used (literal segment).

powerline.segments.vim.tab_modified_indicator()

  Return a file modified indicator for tabpages.

  Parameters:

    text (string) – text to display if any buffer in the current tab is modified

  Highlight groups used: `tab_modified_indicator` or `modified_indicator`.

powerline.segments.vim.tabnr(show_current=True)

  Show tabpage number

  Parameters:

    show_current (bool) – If False do not show current tabpage number. This is default because tabnr is by default only present in tabline.

powerline.segments.vim.trailing_whitespace()

  Return the line number for trailing whitespaces

  It is advised not to use this segment in insert mode: in Insert mode it will iterate over all lines in buffer each time you happen to type a character which may cause lags. It will also show you whitespace warning each time you happen to type space.

  Highlight groups used: `trailing_whitespace` or `warning`.

powerline.segments.vim.virtcol_current(gradient=True)

  Return current visual column with concealed characters ignored

  Parameters:

    gradient (bool) – Determines whether it should show textwidth-based gradient (gradient level is `virtcol * 100 / textwidth`).

  Highlight groups used: `virtcol_current_gradient` (gradient), `virtcol_current` or `col_current`.

powerline.segments.vim.visual_range()

  Return the current visual selection range.

  Parameters:

    - CTRL_V_text (str) – Text to display when in block visual or select mode.

    - v_text_oneline (str) – Text to display when in charaterwise visual or select mode, assuming selection occupies only one line.

    - v_text_multiline (str) – Text to display when in charaterwise visual or select mode, assuming selection occupies more then one line.

    - V_text (str) – Text to display when in linewise visual or select mode.

  All texts are format strings which are passed the following parameters:

  Parameter | Description
  --- | ---
  sline | Line number of the first line of the selection
  eline | Line number of the last line of the selection
  scol | Column number of the first character of the selection
  ecol | Column number of the last character of the selection
  svcol | Virtual column number of the first character of the selection
  secol | Virtual column number of the last character of the selection
  rows | Number of lines in the selection
  cols | Number of columns in the selection
  vcols | Number of virtual columns in the selection

powerline.segments.vim.window_title()

  Return the window title.

  This currently looks at the `quickfix_title` window variable, which is used by Syntastic and Vim itself.

  It is used in the quickfix theme.

powerline.segments.vim.winnr(show_current=True)

  Show window number

  Parameters:

    show_current (bool) – If False do not show current window number.

## Plugin-specific segments

### Asynchronous Linter Engine (ALE) segments

powerline.segments.vim.plugin.ale.ale()

  Show whether ALE has found any errors or warnings

  Parameters:

    - err_format (str) – Format string for errors.

    - warn_format (str) – Format string for warnings.

  Highlight groups used: `ale:warning` or `warning`, `ale:error` or `error`.

### Syntastic segments

powerline.segments.vim.plugin.syntastic.syntastic()

  Show whether syntastic has found any errors or warnings

  Parameters:

    - err_format (str) – Format string for errors.

    - warn_format (str) – Format string for warnings.

  Highlight groups used: `syntastic:warning` or `warning`, `syntastic:error` or `error`.

### Command-T segments

powerline.segments.vim.plugin.commandt.finder()

  Display Command-T finder name

  Requires $command_t.active_finder and methods (code above may monkey-patch $command_t to add them). All Command-T finders have `CommandT::` module prefix, but it is stripped out (actually, any `CommandT::` substring will be stripped out).

  Highlight groups used: `commandt:finder`.

powerline.segments.vim.plugin.commandt.path()

  Display path used by Command-T

  Requires $command_t.active_finder and .path methods (code above may monkey-patch $command_t to add them).

  $command_t.active_finder is required in order to omit displaying path for finders `MRUBufferFinder`, `BufferFinder`, `TagFinder` and `JumpFinder` (pretty much any finder, except `FileFinder`).

  Highlight groups used: `commandt:path`.

### Tagbar segments

powerline.segments.vim.plugin.tagbar.current_tag()

  Return tag that is near the cursor.

  Parameters:

    flags (str) –

    Specifies additional properties of the displayed tag. Supported values:

    - s - display complete signature

    - f - display the full hierarchy of the tag

    - p - display the raw prototype

    More info in the official documentation (search for “tagbar#currenttag”).

### NERDTree segments

powerline.segments.vim.plugin.nerdtree.nerdtree()

  Return directory that is shown by the current buffer.

  Highlight groups used: `nerdtree:path` or `file_name`.

### Capslock segments

powerline.segments.vim.plugin.capslock.capslock_indicator()

  Shows the indicator if tpope/vim-capslock plugin is enabled

  Note

  In the current state plugin automatically disables itself when leaving insert mode. So trying to use this segment not in insert or replace modes is useless.

  Parameters:

    text (str) – String to show when software capslock presented by this plugin is active.