recognition was
added without modifying code that reacts on mouse clicks on
this label.
Use |getmousepos()|.winid in the specified function to get the
corresponding window id of the clicked item.
< - Where to truncate line if too long. Default is at the start.
No width fields allowed.
= - Separation point between alignment sections. Each section will
be separated by an equal number of spaces. With one %= what
comes after it will be right-aligned. With two %= there is a
middle part, with white space left and right of it.
No width fields allowed.
# - Set highlight group. The name must follow and then a # again.
Thus use %#HLname# for highlight group HLname. The same
highlighting is used, also for the statusline of non-current
windows.
* - Set highlight group to User{N}, where {N} is taken from the
minwid field, e.g. %1*. Restore normal highlight with %* or %0*.
The difference between User{N} and StatusLine will be applied to
StatusLineNC for the statusline of non-current windows.
The number N must be between 1 and 9. See |hl-User1..9|
When displaying a flag, Vim removes the leading comma, if any, when
that flag comes right after plaintext. This will make a nice display
when flags are used like in the examples below.
When all items in a group becomes an empty string (i.e. flags that are
not set) and a minwid is not set for the group, the whole group will
become empty. This will make a group like the following disappear
completely from the statusline when none of the flags are set. >vim
set statusline=...%(\ [%M%R%H]%)...
< Beware that an expression is evaluated each and every time the status
line is displayed.
*stl-%{* *g:actual_curbuf* *g:actual_curwin*
While evaluating %{} the current buffer and current window will be set
temporarily to that of the window (and buffer) whose statusline is
currently being drawn. The expression will evaluate in this context.
The variable "g:actual_curbuf" is set to the `bufnr()` number of the
real current buffer and "g:actual_curwin" to the |window-ID| of the
real current window. These values are strings.
The 'statusline' option will be evaluated in the |sandbox| if set from
a modeline, see |sandbox-option|.
This option cannot be set in a modeline when 'modelineexpr' is off.
It is not allowed to change text or jump to another window while
evaluating 'statusline' |textlock|.
If the statusline is not updated when you want it (e.g., after setting
a variable that's used in an expression), you can force an update by
using `:redrawstatus`.
A result of all digits is regarded a number for display purposes.
Otherwise the result is taken as flag text and applied to the rules
described above.
Watch out for errors in expressions. They may render Vim unusable!
If you are stuck, hold down ':' or 'Q' to get a prompt, then quit and
edit your vimrc or whatever with "vim --clean" to get it right.
Examples:
Emulate standard status line with 'ruler' set >vim
set statusline=%<%f\ %h%w%m%r%=%-14.(%l,%c%V%)\ %P
< Similar, but add ASCII value of char under the cursor (like "ga") >vim
set statusline=%<%f%h%m%r%=%b\ 0x%B\ \ %l,%c%V\ %P
< Display byte count and byte value, modified flag in red. >vim
set statusline=%<%f%=\ [%1*%M%*%n%R%H]\ %-19(%3l,%02c%03V%)%O'%02b'
hi User1 term=inverse,bold cterm=inverse,bold ctermfg=red
< Display a ,GZ flag if a compressed file is loaded >vim
set statusline=...%r%{VarExists('b:gzflag','\ [GZ]')}%h...
< In the |:autocmd|'s: >vim
let b:gzflag = 1
< And: >vim
unlet b:gzflag
< And define this function: >vim
function VarExists(var, val)
if exists(a:var) | return a:val | else | return '' | endif
endfunction
<
*'suffixes'* *'su'*
'suffixes' 'su' string (default ".bak,~,.o,.h,.info,.swp,.obj")
global
Files with these suffixes get a lower priority when multiple files