Vim segments

powerline.segments.vim.branch(status_colors=False)[source]

Return the current working branch.

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

Highlight groups used: branch_clean, branch_dirty, branch.

Divider highlight group used: branch:divider.

powerline.segments.vim.bufferlister()[source]

List all buffers in segment_info format

Specifically generates a list of segment info dictionaries with buffer and bufnr keys set to buffer-specific ones, window, winnr and window_id keys unset.

Sets segment mode to either buf (for current buffer) or nc (for all other buffers).

powerline.segments.vim.bufnr(show_current=False)[source]

Show buffer number

Parameters:show_current (bool) – If False do not show current window number.
powerline.segments.vim.col_current()[source]

Return the current cursor column.

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

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)[source]

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)[source]

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(no_file_text=u'[No file]', display_no_file=False)[source]

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()[source]

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(si_prefix=False, suffix=u'B')[source]

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)[source]

Return file type.

Returns:file type or None if unknown file type

Divider highlight group used: background:divider.

powerline.segments.vim.file_vcs_status()[source]

Return the VCS status for this buffer.

Highlight groups used: file_vcs_status.

powerline.segments.vim.line_count()[source]

Return the line count of the current buffer.

powerline.segments.vim.line_current()[source]

Return the current cursor line.

powerline.segments.vim.line_percent(gradient=False)[source]

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)[source]

Return the current vim mode.

Parameters:override (dict) – dict for overriding default mode strings, e.g. { 'n': 'NORM' }
powerline.segments.vim.modified_buffers(join_str=u', ', text=u'+ ')[source]

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(text=u'+')[source]

Return a file modified indicator.

Parameters:text (string) – text to display if the current buffer is modified
powerline.segments.vim.paste_indicator(text=u'PASTE')[source]

Return a paste mode indicator.

Parameters:text (string) – text to display if paste mode is enabled
powerline.segments.vim.position(gradient=False, position_strings={u'top': u'Top', u'all': u'All', u'bottom': u'Bot'})[source]

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(text=u'\ue0a2')[source]

Return a read-only indicator.

Parameters:text (string) – text to display if the current buffer is read-only
powerline.segments.vim.single_tab(multiple_text=u'Tabs', single_text=u'Bufs')[source]

Show one text if there is only one tab and another if there are many

Mostly useful for tabline to indicate what kind of data is shown there.

Parameters:
  • single_text (str) – Text displayed when there is only one tabpage. May be None if you do not want to display anything.
  • multiple_text (str) – Text displayed when there is more then one tabpage. May be None if you do not want to display anything.

Highlight groups used: single_tab, many_tabs.

powerline.segments.vim.tablister()[source]

List all tab pages in segment_info format

Specifically generates a list of segment info dictionaries with window, winnr, window_id, buffer and bufnr keys set to tab-local ones and additional tabpage and tabnr keys.

Sets segment mode to either tab (for current tab page) or nc (for all other tab pages).

Works best with vim-7.4 or later: earlier versions miss tabpage object and thus window objects are not available as well.

powerline.segments.vim.tabnr(show_current=False)[source]

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()[source]

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)[source]

Return current visual column with concealed characters ingored

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(V_text=u'L:{rows}', v_text_multiline=u'L:{rows}', v_text_oneline=u'C:{vcols}', CTRL_V_text=u'{rows} \xd7 {vcols}')[source]

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()[source]

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=False)[source]

Show window number

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

Previous topic

Shell segments

Next topic

Local configuration overrides

This Page