*sign.txt* Nvim
VIM REFERENCE MANUAL by Gordon Prieur
and Bram Moolenaar
Sign Support Features *sign-support*
Type |gO| to see the table of contents.
==============================================================================
1. Introduction *sign-intro* *signs* *gutter*
When a debugger or other IDE tool is driving an editor it needs to be able
to give specific highlights which quickly tell the user useful information
about the file. One example of this would be a debugger which had an icon
in the left-hand column denoting a breakpoint. Another example might be an
arrow representing the Program Counter (PC). The sign features allow both
placement of a sign, or icon, in the left-hand side of the window and
definition of a highlight which will be applied to that line. Displaying the
sign as an image is most likely only feasible in gvim (although Sun
Microsystem's dtterm does support this it's the only terminal emulator I know
of which does). A text sign and the highlight should be feasible in any color
terminal emulator.
Signs and highlights are not useful just for debuggers. There are plugins
that use signs to mark build errors or display version control status.
There are two steps in using signs:
1. Define the sign. This specifies the image, text and highlighting. For
example, you can define a "break" sign with an image of a stop roadsign and
text "!!".
2. Place the sign. This specifies the file and line number where the sign is
displayed. A defined sign can be placed several times in different lines
and files.
*sign-column*
When signs are defined for a file, Vim will automatically add a column of two
characters to display them in. When the last sign is unplaced the column
disappears again. This behavior can be changed with the 'signcolumn' option.
The color of the column is set with the SignColumn highlight group
|hl-SignColumn|. Example to set the color: >
:highlight SignColumn guibg=darkgrey
<
If 'cursorline' is enabled, then the CursorLineSign highlight group is used
|hl-CursorLineSign|.
*sign-identifier*
Each placed sign is identified by a number called the sign identifier. This
identifier is used to jump to the sign or to remove the sign. The identifier
is assigned when placing the sign using the |:sign-place| command or the
|sign_place()| function. Each sign identifier should be a unique number (per
buffer). Placing the same identifier twice will move the previously placed
sign. The |sign_place()| function can be called with a zero sign identifier to
allocate the next available identifier.
*sign-group*
Each placed sign can be assigned to either the global group or a named group.
When placing a sign, if a group name is not supplied, or an empty string is
used, then the sign is placed in the global group. Otherwise the sign is
placed in the named group. The sign identifier is unique within a group. The
sign group 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