Home Explore Blog CI



neovim

2nd chunk of `runtime/doc/sign.txt`
e9117aa717ddda4a7a707d4c4f5fb026e075ba21fb7c0e6f0000000100000fa0
 allows Vim plugins to use unique signs without interfering with
other plugins using signs.

							*sign-priority*
Each placed sign is assigned a priority value independently of the sign group.
The default priority for a sign is 10, this value can be changed for different
signs by specifying a different value at definition time. When multiple signs
that each have an icon or text are placed on the same line, signs are ordered
with decreasing priority from left to right, up until the maximum width set in
'signcolumn'. Low priority signs that do not fit are hidden. Highest priority
signs with highlight attributes are always shown.

When the line on which the sign is placed is deleted, the sign is removed along
with it.

==============================================================================
2. Commands					*sign-commands* *:sig* *:sign*

Here is an example that places a sign "piet", displayed with the text ">>", in
line 23 of the current file: >
	:sign define piet text=>> texthl=Search
	:exe ":sign place 2 line=23 name=piet file=" .. expand("%:p")

And here is the command to delete it again: >
	:sign unplace 2

Note that the ":sign" command cannot be followed by another command or a
comment.  If you do need that, use the |:execute| command.


DEFINING A SIGN.			*:sign-define* *E255* *E160* *E612*

See |sign_define()| for the equivalent Vim script function.

:sign define {name} {argument}...
		Define a new sign or set attributes for an existing sign.
		The {name} can either be a number (all digits) or a name
		starting with a non-digit.  Leading zeros are ignored, thus
		"0012", "012" and "12" are considered the same name.
		About 120 different signs can be defined.

		Accepted arguments:

	icon={bitmap}
		Define the file name where the bitmap can be found.  Should be
		a full path.  The bitmap should fit in the place of two
		characters.  This is not checked.  If the bitmap is too big it
		will cause redraw problems.
			toolkit		supports ~
			Win32		.bmp, .ico, .cur

	priority={prio}
		Default priority for the sign, see |sign-priority|.

	linehl={group}
		Highlighting group used for the whole line the sign is placed
		in.  Most useful is defining a background color.

	numhl={group}
		Highlighting group used for the line number on the line where
		the sign is placed.  Combines with |hl-LineNr|,
		|hl-LineNrAbove|, |hl-LineNrBelow|, and |hl-CursorLineNr|.

	text={text}						*E239*
		Define the text that is displayed when there is no icon or the
		GUI is not being used.  Only printable characters are allowed
		and they must occupy one or two display cells.

	texthl={group}
		Highlighting group used for the text item.

	culhl={group}
		Highlighting group used for the text item when the cursor is
		on the same line as the sign and 'cursorline' is enabled.

	Example: >
		:sign define MySign text=>> texthl=Search linehl=DiffText
<

DELETING A SIGN						*:sign-undefine* *E155*

See |sign_undefine()| for the equivalent Vim script function.

:sign undefine {name}
		Deletes a previously defined sign.  If signs with this {name}
		are still placed this will cause trouble.

		Example: >
			:sign undefine MySign
<

LISTING SIGNS						*:sign-list* *E156*

See |sign_getdefined()| for the equivalent Vim script function.

:sign list	Lists all defined signs and their attributes.

:sign list {name}
		Lists one defined sign and its attributes.


PLACING SIGNS						*:sign-place* *E158*

See |sign_place()| for the equivalent Vim script function.

:sign place {id} line={lnum} name={name} file={fname}
		Place sign defined as {name} at line {lnum} in file {fname}.
							*:sign-fname*
		The file {fname} must already be loaded in a buffer.  The
		exact file name must be used, wildcards, $ENV and ~ are not
		expanded, white space must not be escaped.  Trailing white
		space is ignored.

		The sign is remembered under {id}, this can be used for
		further manipulation.  {id} must be a number.  Placing the
		same {id} multiple times will move the sign.

Title: Sign Priority, Commands, and Definitions
Summary
This section details sign priority, sign commands, and sign definitions in Vim. It covers how signs are ordered on a line based on priority and how the ':sign' command is used to define, place, and remove signs. The section describes the syntax for defining signs, including arguments for icon, priority, highlighting, and text.