blob: bd63ea9ade2b2514cb42e9d9c1d1205c39fbbf47 [file] [log] [blame]
Bram Moolenaarb1c91982018-05-17 17:04:55 +02001*sign.txt* For Vim version 8.1. Last change: 2016 Aug 17
Bram Moolenaar071d4272004-06-13 20:20:40 +00002
3
4 VIM REFERENCE MANUAL by Gordon Prieur
5 and Bram Moolenaar
6
7
8Sign Support Features *sign-support*
9
101. Introduction |sign-intro|
112. Commands |sign-commands|
12
13{Vi does not have any of these features}
14{only available when compiled with the |+signs| feature}
15
16==============================================================================
171. Introduction *sign-intro* *signs*
18
19When a debugger or other IDE tool is driving an editor it needs to be able
20to give specific highlights which quickly tell the user useful information
Bram Moolenaar402d2fe2005-04-15 21:00:38 +000021about the file. One example of this would be a debugger which had an icon
22in the left-hand column denoting a breakpoint. Another example might be an
23arrow representing the Program Counter (PC). The sign features allow both
Bram Moolenaar071d4272004-06-13 20:20:40 +000024placement of a sign, or icon, in the left-hand side of the window and
Bram Moolenaar402d2fe2005-04-15 21:00:38 +000025definition of a highlight which will be applied to that line. Displaying the
Bram Moolenaar071d4272004-06-13 20:20:40 +000026sign as an image is most likely only feasible in gvim (although Sun
Bram Moolenaar402d2fe2005-04-15 21:00:38 +000027Microsystem's dtterm does support this it's the only terminal emulator I know
Bram Moolenaar071d4272004-06-13 20:20:40 +000028of which does). A text sign and the highlight should be feasible in any color
29terminal emulator.
30
Bram Moolenaar402d2fe2005-04-15 21:00:38 +000031Signs and highlights are not useful just for debuggers. Sun's Visual
Bram Moolenaar071d4272004-06-13 20:20:40 +000032WorkShop uses signs and highlights to mark build errors and SourceBrowser
Bram Moolenaar402d2fe2005-04-15 21:00:38 +000033hits. Additionally, the debugger supports 8 to 10 different signs and
Bram Moolenaar071d4272004-06-13 20:20:40 +000034highlight colors. |workshop| Same for Netbeans |netbeans|.
35
36There are two steps in using signs:
37
381. Define the sign. This specifies the image, text and highlighting. For
39 example, you can define a "break" sign with an image of a stop roadsign and
40 text "!!".
41
422. Place the sign. This specifies the file and line number where the sign is
43 displayed. A defined sign can be placed several times in different lines
44 and files.
45
46When signs are defined for a file, Vim will automatically add a column of two
47characters to display them in. When the last sign is unplaced the column
Bram Moolenaar09521312016-08-12 22:54:35 +020048disappears again. This behavior can be changed with the 'signcolumn' option.
49
50The color of the column is set with the SignColumn group |hl-SignColumn|.
51Example to set the color: >
Bram Moolenaar071d4272004-06-13 20:20:40 +000052
53 :highlight SignColumn guibg=darkgrey
54
55==============================================================================
562. Commands *sign-commands* *:sig* *:sign*
57
Bram Moolenaar00a927d2010-05-14 23:24:24 +020058Here is an example that places a sign "piet", displayed with the text ">>", in
Bram Moolenaar071d4272004-06-13 20:20:40 +000059line 23 of the current file: >
60 :sign define piet text=>> texthl=Search
61 :exe ":sign place 2 line=23 name=piet file=" . expand("%:p")
62
63And here is the command to delete it again: >
64 :sign unplace 2
65
66Note that the ":sign" command cannot be followed by another command or a
67comment. If you do need that, use the |:execute| command.
68
69
70DEFINING A SIGN. *:sign-define* *E255* *E160* *E612*
71
72:sign define {name} {argument}...
73 Define a new sign or set attributes for an existing sign.
74 The {name} can either be a number (all digits) or a name
Bram Moolenaar483c5d82010-10-20 18:45:33 +020075 starting with a non-digit. Leading digits are ignored, thus
76 "0012", "012" and "12" are considered the same name.
Bram Moolenaar071d4272004-06-13 20:20:40 +000077 About 120 different signs can be defined.
78
79 Accepted arguments:
80
Bram Moolenaar6ee8d892012-01-10 14:55:01 +010081 icon={bitmap}
Bram Moolenaar071d4272004-06-13 20:20:40 +000082 Define the file name where the bitmap can be found. Should be
83 a full path. The bitmap should fit in the place of two
84 characters. This is not checked. If the bitmap is too big it
85 will cause redraw problems. Only GTK 2 can scale the bitmap
86 to fit the space available.
87 toolkit supports ~
88 GTK 1 pixmap (.xpm)
89 GTK 2 many
90 Motif pixmap (.xpm)
Bram Moolenaar6ee8d892012-01-10 14:55:01 +010091 Win32 .bmp, .ico, .cur
92 pixmap (.xpm) |+xpm_w32|
Bram Moolenaar071d4272004-06-13 20:20:40 +000093
94 linehl={group}
95 Highlighting group used for the whole line the sign is placed
96 in. Most useful is defining a background color.
97
98 text={text} *E239*
99 Define the text that is displayed when there is no icon or the
100 GUI is not being used. Only printable characters are allowed
101 and they must occupy one or two display cells.
102
103 texthl={group}
104 Highlighting group used for the text item.
105
106
107DELETING A SIGN *:sign-undefine* *E155*
108
109:sign undefine {name}
110 Deletes a previously defined sign. If signs with this {name}
111 are still placed this will cause trouble.
112
113
114LISTING SIGNS *:sign-list* *E156*
115
116:sign list Lists all defined signs and their attributes.
117
118:sign list {name}
119 Lists one defined sign and its attributes.
120
121
122PLACING SIGNS *:sign-place* *E158*
123
124:sign place {id} line={lnum} name={name} file={fname}
125 Place sign defined as {name} at line {lnum} in file {fname}.
126 *:sign-fname*
127 The file {fname} must already be loaded in a buffer. The
128 exact file name must be used, wildcards, $ENV and ~ are not
129 expanded, white space must not be escaped. Trailing white
130 space is ignored.
131
132 The sign is remembered under {id}, this can be used for
133 further manipulation. {id} must be a number.
134 It's up to the user to make sure the {id} is used only once in
135 each file (if it's used several times unplacing will also have
136 to be done several times and making changes may not work as
137 expected).
138
139:sign place {id} line={lnum} name={name} buffer={nr}
140 Same, but use buffer {nr}.
141
Bram Moolenaare968e362014-05-13 20:23:24 +0200142 *E885*
Bram Moolenaar071d4272004-06-13 20:20:40 +0000143:sign place {id} name={name} file={fname}
144 Change the placed sign {id} in file {fname} to use the defined
145 sign {name}. See remark above about {fname} |:sign-fname|.
146 This can be used to change the displayed sign without moving
147 it (e.g., when the debugger has stopped at a breakpoint).
148
149:sign place {id} name={name} buffer={nr}
150 Same, but use buffer {nr}.
151
152
153REMOVING SIGNS *:sign-unplace* *E159*
154
155:sign unplace {id} file={fname}
156 Remove the previously placed sign {id} from file {fname}.
157 See remark above about {fname} |:sign-fname|.
158
Bram Moolenaarf65e5662012-07-10 15:18:22 +0200159:sign unplace * file={fname}
160 Remove all placed signs in file {fname}.
161
Bram Moolenaar071d4272004-06-13 20:20:40 +0000162:sign unplace {id} buffer={nr}
Bram Moolenaarf65e5662012-07-10 15:18:22 +0200163 Remove the previously placed sign {id} from buffer {nr}.
164
165:sign unplace * buffer={nr}
166 Remove all placed signs in buffer {nr}.
Bram Moolenaar071d4272004-06-13 20:20:40 +0000167
168:sign unplace {id}
169 Remove the previously placed sign {id} from all files it
170 appears in.
171
172:sign unplace *
173 Remove all placed signs.
174
175:sign unplace
176 Remove the placed sign at the cursor position.
177
178
Bram Moolenaar36782082013-11-28 13:53:34 +0100179LISTING PLACED SIGNS *:sign-place-list*
Bram Moolenaar071d4272004-06-13 20:20:40 +0000180
181:sign place file={fname}
182 List signs placed in file {fname}.
183 See remark above about {fname} |:sign-fname|.
184
185:sign place buffer={nr}
186 List signs placed in buffer {nr}.
187
188:sign place List placed signs in all files.
189
190
191JUMPING TO A SIGN *:sign-jump* *E157*
192
193:sign jump {id} file={fname}
194 Open the file {fname} or jump to the window that contains
195 {fname} and position the cursor at sign {id}.
196 See remark above about {fname} |:sign-fname|.
197 If the file isn't displayed in window and the current file can
198 not be |abandon|ed this fails.
199
Bram Moolenaar7571d552016-08-18 22:54:46 +0200200:sign jump {id} buffer={nr} *E934*
201 Same, but use buffer {nr}. This fails if buffer {nr} does not
202 have a name.
203
Bram Moolenaar071d4272004-06-13 20:20:40 +0000204
Bram Moolenaar91f84f62018-07-29 15:07:52 +0200205 vim:tw=78:ts=8:noet:ft=help:norl: