patch 8.2.2854: custom statusline cannot contain % items

Problem:    Custom statusline cannot contain % items.
Solution:   Add "%{% expr %}". (closes #8190)
This commit is contained in:
shadmansaleh
2021-05-15 17:23:28 +02:00
committed by Bram Moolenaar
parent d832c3c56e
commit 30e3de21fc
5 changed files with 106 additions and 5 deletions

View File

@ -7339,6 +7339,18 @@ A jump table for the options with a short description can be found at |Q_op|.
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 %}.
The For example: >
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 be followed by %) somewhere.
) - End of item group. No width fields allowed.