Vim segments¶
- 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 ifstatus_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)[source]¶
Show buffer number
- Parameters:
show_current (bool) – If False do not show current window number.
- powerline.segments.vim.csv_col_current()[source]¶
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 casecsv.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 toTrue
or"auto"
). Acceptscolumn_name
keyword argument.
Highlight groups used:
csv:column_number
orcsv
,csv:column_name
orcsv
.
- powerline.segments.vim.file_bom(segment_info)[source]¶
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)[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()[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
orfile_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 likezipfile:/path/to/archive.zip::file.txt
.file_scheme
segment will catchzipfile
part here.
- powerline.segments.vim.file_size()[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_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.
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()[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()[source]¶
Return a file modified indicator.
- Parameters:
text (string) – text to display if the current buffer is modified
- powerline.segments.vim.paste_indicator()[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={'top': 'Top', 'bottom': 'Bot', 'all': 'All'})[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()[source]¶
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)[source]¶
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()[source]¶
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
ormodified_indicator
.
- powerline.segments.vim.tabnr(show_current=True)[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
orwarning
.
- powerline.segments.vim.virtcol_current(gradient=True)[source]¶
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
orcol_current
.
- powerline.segments.vim.visual_range()[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=True)[source]¶
Show window number
- Parameters:
show_current (bool) – If False do not show current window number.
Plugin-specific segments¶
Asynchronous Linter Engine (ALE) segments¶
Syntastic segments¶
- powerline.segments.vim.plugin.syntastic.syntastic()[source]¶
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
orwarning
,syntastic:error
orerror
.
Command-T segments¶
- powerline.segments.vim.plugin.commandt.finder()[source]¶
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, anyCommandT::
substring will be stripped out).Highlight groups used:
commandt:finder
.
- powerline.segments.vim.plugin.commandt.path()[source]¶
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
andJumpFinder
(pretty much any finder, exceptFileFinder
).Highlight groups used:
commandt:path
.
Tagbar segments¶
- powerline.segments.vim.plugin.tagbar.current_tag()[source]¶
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¶
Capslock segments¶
- powerline.segments.vim.plugin.capslock.capslock_indicator()[source]¶
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.