Home Explore Blog CI



neovim

92th chunk of `runtime/doc/options.txt`
b47a274df317948d918313aec55a9e21c26fdbf20b66b8140000000100000fa5
 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 be followed by %) somewhere.
	) -   End of item group.  No width fields allowed.
	T N   For 'tabline': start of tab page N label.  Use %T or %X to end
	      the label.  Clicking this label with left mouse button switches
	      to the specified tab page, while clicking it with middle mouse
	      button closes the specified tab page.
	X N   For 'tabline': start of close tab N label.  Use %X or %T to end
	      the label, e.g.: %3Xclose%X.  Use %999X for a "close current
	      tab" label.  Clicking this label with left mouse button closes
	      the specified tab page.
	@ N   Start of execute function label. Use %X or %T to end the label,
	      e.g.: %10@SwitchBuffer@foo.c%X.  Clicking this label runs the
	      specified function: in the example when clicking once using left
	      mouse button on "foo.c", a `SwitchBuffer(10, 1, 'l', '    ')`
	      expression will be run.  The specified function receives the
	      following arguments in order:
	      1. minwid field value or zero if no N was specified
	      2. number of mouse clicks to detect multiple clicks
	      3. mouse button used: "l", "r" or "m" for left, right or middle
	         button respectively; one should not rely on third argument
	         being only "l", "r" or "m": any other non-empty string value
	         that contains only ASCII lower case letters may be expected
	         for other mouse buttons
	      4. modifiers pressed: string which contains "s" if shift
	         modifier was pressed, "c" for control, "a" for alt and "m"
	         for meta; currently if modifier is not pressed string
	         contains space instead, but one should not rely on presence
	         of spaces or specific order of modifiers: use |stridx()| to
	         test whether some modifier is present; string is guaranteed
	         to contain only ASCII letters and spaces, one letter per
	         modifier; "?" modifier may also be present, but its presence
	         is a bug that denotes that new mouse button 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

Title: Statusline and Tabline Items: Grouping, Truncation, Alignment, Highlighting, and Functions
Summary
This section describes several features of the 'statusline' and 'tabline' options, including grouping items with parentheses, truncating the line if it's too long, controlling alignment with '=', setting highlight groups with '#', and setting highlight to User{N} with '*'. It also details the usage of %T, %X, and %@ for customizing tab labels and assigning functions to tab label clicks, explaining how to pass parameters to the called function.