Home Explore Blog CI



neovim

90th chunk of `runtime/doc/options.txt`
697f6b17bae8cab0952210d653e215a47c9c8dd35ebf02da0000000100000fa3
 line
	%s	sign column for currently drawn line
	%C	fold column for currently drawn line

	The 'statuscolumn' width follows that of the default columns and
	adapts to the |'numberwidth'|, |'signcolumn'| and |'foldcolumn'| option
	values (regardless of whether the sign and fold items are present).
	Additionally, the 'statuscolumn' grows with the size of the evaluated
	format string, up to a point (following the maximum size of the default
	fold, sign and number columns). Shrinking only happens when the number
	of lines in a buffer changes, or the 'statuscolumn' option is set.

	The |v:lnum|    variable holds the line number to be drawn.
	The |v:relnum|  variable holds the relative line number to be drawn.
	The |v:virtnum| variable is negative when drawing virtual lines, zero
		      when drawing the actual buffer line, and positive when
		      drawing the wrapped part of a buffer line.

	When using |v:relnum|, keep in mind that cursor movement by itself will
	not cause the 'statuscolumn' to update unless |'relativenumber'| is set.

	NOTE: The %@ click execute function item is supported as well but the
	specified function will be the same for each row in the same column.
	It cannot be switched out through a dynamic 'statuscolumn' format, the
	handler should be written with this in mind.

	Examples: >vim
		" Line number with bar separator and click handlers:
		set statuscolumn=%@SignCb@%s%=%T%@NumCb@%l│%T

		" Line numbers in hexadecimal for non wrapped part of lines:
		let &stc='%=%{v:virtnum>0?"":printf("%x",v:lnum)} '

		" Human readable line numbers with thousands separator:
		let &stc='%{substitute(v:lnum,"\\d\\zs\\ze\\'
			   . '%(\\d\\d\\d\\)\\+$",",","g")}'

		" Both relative and absolute line numbers with different
		" highlighting for odd and even relative numbers:
		let &stc='%#NonText#%{&nu?v:lnum:""}' .
		 '%=%{&rnu&&(v:lnum%2)?"\ ".v:relnum:""}' .
		 '%#LineNr#%{&rnu&&!(v:lnum%2)?"\ ".v:relnum:""}'

<	WARNING: this expression is evaluated for each screen line so defining
	an expensive expression can negatively affect render performance.

					*'statusline'* *'stl'* *E540* *E542*
'statusline' 'stl'	string	(default "%<%f %h%w%m%r %=%{% &showcmdloc == 'statusline' ? '%-10.S ' : '' %}%{% exists('b:keymap_name') ? '<'..b:keymap_name..'> ' : '' %}%{% &ruler ? ( &rulerformat == '' ? '%-14.(%l,%c%V%) %P' : &rulerformat ) : '' %}")
			global or local to window |global-local|
	Sets the |status-line|.

	The option consists of printf style '%' items interspersed with
	normal text.  Each status line item is of the form:
	  %-0{minwid}.{maxwid}{item}
	All fields except the {item} are optional.  A single percent sign can
	be given as "%%".

							*stl-%!*
	When the option starts with "%!" then it is used as an expression,
	evaluated and the result is used as the option value.  Example: >vim
		set statusline=%!MyStatusLine()
<	The *g:statusline_winid* variable will be set to the |window-ID| of the
	window that the status line belongs to.
	The result 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

Title: Vim Option: 'statuscolumn' (continued) and 'statusline'
Summary
This section continues detailing the `statuscolumn` option with examples and a warning about performance. It then introduces and extensively describes the `statusline` option. The `statusline` option is used to customize the status line. It explains the formatting codes and special items that can be used within the option string to display various information about the current buffer, window, and Vim state. The formatting includes left/right justification, minimum/maximum width, and special characters for representing different pieces of information.