can contain %{} items that will be evaluated too.
Note that the "%!" expression is evaluated in the context of the
current window and buffer, while %{} items are evaluated in the
context of the window that the statusline belongs to.
When there is error while evaluating the option then it will be made
empty to avoid further errors. Otherwise screen updating would loop.
When the result contains unprintable characters the result is
unpredictable.
Note that the only effect of 'ruler' when this option is set (and
'laststatus' is 2 or 3) is controlling the output of |CTRL-G|.
field meaning ~
- Left justify the item. The default is right justified
when minwid is larger than the length of the item.
0 Leading zeroes in numeric items. Overridden by "-".
minwid Minimum width of the item, padding as set by "-" & "0".
Value must be 50 or less.
maxwid Maximum width of the item. Truncation occurs with a "<"
on the left for text items. Numeric items will be
shifted down to maxwid-2 digits followed by ">"number
where number is the amount of missing digits, much like
an exponential notation.
item A one letter code as described below.
Following is a description of the possible statusline items. The
second character in "item" is the type:
N for number
S for string
F for flags as described below
- not applicable
item meaning ~
f S Path to the file in the buffer, as typed or relative to current
directory.
F S Full path to the file in the buffer.
t S File name (tail) of file in the buffer.
m F Modified flag, text is "[+]"; "[-]" if 'modifiable' is off.
M F Modified flag, text is ",+" or ",-".
r F Readonly flag, text is "[RO]".
R F Readonly flag, text is ",RO".
h F Help buffer flag, text is "[help]".
H F Help buffer flag, text is ",HLP".
w F Preview window flag, text is "[Preview]".
W F Preview window flag, text is ",PRV".
y F Type of file in the buffer, e.g., "[vim]". See 'filetype'.
Y F Type of file in the buffer, e.g., ",VIM". See 'filetype'.
q S "[Quickfix List]", "[Location List]" or empty.
k S Value of "b:keymap_name" or 'keymap' when |:lmap| mappings are
being used: "<keymap>"
n N Buffer number.
b N Value of character under cursor.
B N As above, in hexadecimal.
o N Byte number in file of byte under cursor, first byte is 1.
Mnemonic: Offset from start of file (with one added)
O N As above, in hexadecimal.
l N Line number.
L N Number of lines in buffer.
c N Column number (byte index).
v N Virtual column number (screen column).
V N Virtual column number as -{num}. Not displayed if equal to 'c'.
p N Percentage through file in lines as in |CTRL-G|.
P S Percentage through file of displayed window. This is like the
percentage described for 'ruler'. Always 3 in length, unless
translated.
S S 'showcmd' content, see 'showcmdloc'.
a S Argument list status as in default title. ({current} of {max})
Empty if the argument file count is zero or one.
{ NF Evaluate expression between "%{" and "}" and substitute result.
Note that there is no "%" before the closing "}". The
expression cannot contain a "}" character, call a function to
work around that. See |stl-%{| below.
`{%` - This is almost same as "{" except the result of the expression is
re-evaluated as a statusline format string. Thus if the
return value of expr contains "%" items they will get expanded.
The expression can contain the "}" character, the end of
expression is denoted by "%}".
For example: >vim
func! Stl_filename() abort
return "%t"
endfunc
< `stl=%{Stl_filename()}` results in `"%t"`
`stl=%{%Stl_filename()%}` results in `"Name of current file"`
%} - End of "{%" expression
( - Start of item group. Can be used for setting the width and
alignment of a section. Must
Title: Detailed Description of 'statusline' Items and Formatting
Summary
This section provides a detailed breakdown of the various 'statusline' items that can be used to display specific information in the status line. It defines the meaning of different flags (N, S, F, -) and explains each item code (e.g., f, F, t, m, M, r, R, h, H, w, W, y, Y, q, k, n, b, B, o, O, l, L, c, v, V, p, P, S, a) including what kind of data they represent (file path, modification status, read-only status, help buffer, file type, buffer number, cursor position, percentages, etc.). It also describes how to evaluate expressions and include their results in the status line using `%{}` and `%{% %}`.