blob: 96658e544da7b9b9b6912529262d9c46dbb78328 [file] [log] [blame]
Bram Moolenaarc8cdf0f2021-03-13 13:28:13 +01001*sign.txt* For Vim version 8.2. Last change: 2021 Mar 07
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|
Bram Moolenaared997ad2019-07-21 16:42:00 +0200123. Functions |sign-functions-details|
Bram Moolenaar071d4272004-06-13 20:20:40 +000013
Bram Moolenaar071d4272004-06-13 20:20:40 +000014{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 Moolenaard09091d2019-01-17 16:07:22 +010034highlight colors, see |NetBeans|.
Bram Moolenaar071d4272004-06-13 20:20:40 +000035
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
Bram Moolenaard09091d2019-01-17 16:07:22 +010046 *sign-column*
Bram Moolenaar071d4272004-06-13 20:20:40 +000047When signs are defined for a file, Vim will automatically add a column of two
48characters to display them in. When the last sign is unplaced the column
Bram Moolenaar09521312016-08-12 22:54:35 +020049disappears again. This behavior can be changed with the 'signcolumn' option.
50
Bram Moolenaar574ee7b2019-11-13 23:04:29 +010051The color of the column is set with the SignColumn highlight group
52|hl-SignColumn|. Example to set the color: >
Bram Moolenaar071d4272004-06-13 20:20:40 +000053
54 :highlight SignColumn guibg=darkgrey
Bram Moolenaar162b7142018-12-21 15:17:36 +010055<
Bram Moolenaare413ea02021-11-24 16:20:13 +000056If 'cursorline' is enabled, then the CursorLineSign highlight group is used
57|hl-CursorLineSign|.
Bram Moolenaarb328cca2019-01-06 16:24:01 +010058 *sign-identifier*
59Each placed sign is identified by a number called the sign identifier. This
60identifier is used to jump to the sign or to remove the sign. The identifier
Bram Moolenaard09091d2019-01-17 16:07:22 +010061is assigned when placing the sign using the |:sign-place| command or the
Bram Moolenaarb328cca2019-01-06 16:24:01 +010062|sign_place()| function. Each sign identifier should be a unique number. If
63multiple placed signs use the same identifier, then jumping to or removing a
64sign becomes unpredictable. To avoid overlapping identifiers, sign groups can
65be used. The |sign_place()| function can be called with a zero sign identifier
66to allocate the next available identifier.
67
Bram Moolenaar162b7142018-12-21 15:17:36 +010068 *sign-group*
Bram Moolenaarb328cca2019-01-06 16:24:01 +010069Each placed sign can be assigned to either the global group or a named group.
70When placing a sign, if a group name is not supplied, or an empty string is
71used, then the sign is placed in the global group. Otherwise the sign is
72placed in the named group. The sign identifier is unique within a group. The
73sign group allows Vim plugins to use unique signs without interfering with
74other plugins using signs.
Bram Moolenaar162b7142018-12-21 15:17:36 +010075
Bram Moolenaar72570732019-11-30 14:21:53 +010076To place a sign in a popup window the group name must start with "PopUp".
77Other signs will not show in a popup window. The group name "PopUpMenu" is
78used by popup windows where 'cursorline' is set.
79
Bram Moolenaar162b7142018-12-21 15:17:36 +010080 *sign-priority*
81Each placed sign is assigned a priority value. When multiple signs are placed
82on the same line, the attributes of the sign with the highest priority is used
Bram Moolenaar2547aa92020-07-26 17:00:44 +020083independently of the sign group. The default priority for a sign is 10. The
Bram Moolenaar162b7142018-12-21 15:17:36 +010084priority is assigned at the time of placing a sign.
Bram Moolenaar071d4272004-06-13 20:20:40 +000085
Bram Moolenaar3132cdd2020-11-05 20:41:49 +010086When two signs with the same priority are present, and one has an icon or text
87in the signcolumn while the other has line highlighting, then both are
88displayed.
89
Bram Moolenaard09091d2019-01-17 16:07:22 +010090When the line on which the sign is placed is deleted, the sign is moved to the
91next line (or the last line of the buffer, if there is no next line). When
92the delete is undone the sign does not move back.
93
Bram Moolenaar39f7aa32020-08-31 22:00:05 +020094When a sign with line highlighting and 'cursorline' highlighting are both
95present, if the priority is 100 or more then the sign highlighting takes
96precedence, otherwise the 'cursorline' highlighting.
97
Bram Moolenaar071d4272004-06-13 20:20:40 +000098==============================================================================
992. Commands *sign-commands* *:sig* *:sign*
100
Bram Moolenaar00a927d2010-05-14 23:24:24 +0200101Here is an example that places a sign "piet", displayed with the text ">>", in
Bram Moolenaar071d4272004-06-13 20:20:40 +0000102line 23 of the current file: >
103 :sign define piet text=>> texthl=Search
104 :exe ":sign place 2 line=23 name=piet file=" . expand("%:p")
105
106And here is the command to delete it again: >
107 :sign unplace 2
108
109Note that the ":sign" command cannot be followed by another command or a
110comment. If you do need that, use the |:execute| command.
111
112
113DEFINING A SIGN. *:sign-define* *E255* *E160* *E612*
114
Bram Moolenaar162b7142018-12-21 15:17:36 +0100115See |sign_define()| for the equivalent Vim script function.
116
Bram Moolenaar071d4272004-06-13 20:20:40 +0000117:sign define {name} {argument}...
118 Define a new sign or set attributes for an existing sign.
119 The {name} can either be a number (all digits) or a name
Bram Moolenaar4c05fa02019-01-01 15:32:17 +0100120 starting with a non-digit. Leading zeros are ignored, thus
Bram Moolenaar483c5d82010-10-20 18:45:33 +0200121 "0012", "012" and "12" are considered the same name.
Bram Moolenaar071d4272004-06-13 20:20:40 +0000122 About 120 different signs can be defined.
123
124 Accepted arguments:
125
Bram Moolenaar6ee8d892012-01-10 14:55:01 +0100126 icon={bitmap}
Bram Moolenaar071d4272004-06-13 20:20:40 +0000127 Define the file name where the bitmap can be found. Should be
128 a full path. The bitmap should fit in the place of two
129 characters. This is not checked. If the bitmap is too big it
130 will cause redraw problems. Only GTK 2 can scale the bitmap
131 to fit the space available.
132 toolkit supports ~
133 GTK 1 pixmap (.xpm)
134 GTK 2 many
135 Motif pixmap (.xpm)
Bram Moolenaar6ee8d892012-01-10 14:55:01 +0100136 Win32 .bmp, .ico, .cur
137 pixmap (.xpm) |+xpm_w32|
Bram Moolenaar071d4272004-06-13 20:20:40 +0000138
139 linehl={group}
140 Highlighting group used for the whole line the sign is placed
141 in. Most useful is defining a background color.
142
143 text={text} *E239*
144 Define the text that is displayed when there is no icon or the
145 GUI is not being used. Only printable characters are allowed
146 and they must occupy one or two display cells.
147
148 texthl={group}
149 Highlighting group used for the text item.
150
Bram Moolenaarc8cdf0f2021-03-13 13:28:13 +0100151 Example: >
152 :sign define MySign text=>> texthl=Search linehl=DiffText
153<
Bram Moolenaar071d4272004-06-13 20:20:40 +0000154
155DELETING A SIGN *:sign-undefine* *E155*
156
Bram Moolenaar162b7142018-12-21 15:17:36 +0100157See |sign_undefine()| for the equivalent Vim script function.
158
Bram Moolenaar071d4272004-06-13 20:20:40 +0000159:sign undefine {name}
160 Deletes a previously defined sign. If signs with this {name}
161 are still placed this will cause trouble.
162
Bram Moolenaarc8cdf0f2021-03-13 13:28:13 +0100163 Example: >
164 :sign undefine MySign
165<
Bram Moolenaar162b7142018-12-21 15:17:36 +0100166
Bram Moolenaar071d4272004-06-13 20:20:40 +0000167LISTING SIGNS *:sign-list* *E156*
168
Bram Moolenaar162b7142018-12-21 15:17:36 +0100169See |sign_getdefined()| for the equivalent Vim script function.
170
Bram Moolenaar071d4272004-06-13 20:20:40 +0000171:sign list Lists all defined signs and their attributes.
172
173:sign list {name}
174 Lists one defined sign and its attributes.
175
Bram Moolenaare413ea02021-11-24 16:20:13 +0000176 culhl={group}
177 Highlighting group used for the text item when the cursor is
178 on the same line as the sign and 'cursorline' is enabled.
179
180 Example: >
181 :sign define MySign text=>> texthl=Search linehl=DiffText
182<
Bram Moolenaar071d4272004-06-13 20:20:40 +0000183
184PLACING SIGNS *:sign-place* *E158*
185
Bram Moolenaar162b7142018-12-21 15:17:36 +0100186See |sign_place()| for the equivalent Vim script function.
187
Bram Moolenaar071d4272004-06-13 20:20:40 +0000188:sign place {id} line={lnum} name={name} file={fname}
189 Place sign defined as {name} at line {lnum} in file {fname}.
190 *:sign-fname*
191 The file {fname} must already be loaded in a buffer. The
192 exact file name must be used, wildcards, $ENV and ~ are not
193 expanded, white space must not be escaped. Trailing white
194 space is ignored.
195
196 The sign is remembered under {id}, this can be used for
197 further manipulation. {id} must be a number.
198 It's up to the user to make sure the {id} is used only once in
199 each file (if it's used several times unplacing will also have
200 to be done several times and making changes may not work as
201 expected).
202
Bram Moolenaar162b7142018-12-21 15:17:36 +0100203 The following optional sign attributes can be specified before
204 "file=":
205 group={group} Place sign in sign group {group}
206 priority={prio} Assign priority {prio} to sign
207
208 By default, the sign is placed in the global sign group.
209
210 By default, the sign is assigned a default priority of 10. To
211 assign a different priority value, use "priority={prio}" to
Bram Moolenaar58a7f872019-06-04 22:48:15 +0200212 specify a value. The priority is used to determine the sign
213 that is displayed when multiple signs are placed on the same
214 line.
Bram Moolenaar162b7142018-12-21 15:17:36 +0100215
216 Examples: >
217 :sign place 5 line=3 name=sign1 file=a.py
218 :sign place 6 group=g2 line=2 name=sign2 file=x.py
219 :sign place 9 group=g2 priority=50 line=5
220 \ name=sign1 file=a.py
221<
Bram Moolenaarb328cca2019-01-06 16:24:01 +0100222:sign place {id} line={lnum} name={name} [buffer={nr}]
223 Same, but use buffer {nr}. If the buffer argument is not
224 given, place the sign in the current buffer.
Bram Moolenaar071d4272004-06-13 20:20:40 +0000225
Bram Moolenaarc8cdf0f2021-03-13 13:28:13 +0100226 Example: >
227 :sign place 10 line=99 name=sign3
228 :sign place 10 line=99 name=sign3 buffer=3
229<
Bram Moolenaare968e362014-05-13 20:23:24 +0200230 *E885*
Bram Moolenaar071d4272004-06-13 20:20:40 +0000231:sign place {id} name={name} file={fname}
232 Change the placed sign {id} in file {fname} to use the defined
233 sign {name}. See remark above about {fname} |:sign-fname|.
234 This can be used to change the displayed sign without moving
235 it (e.g., when the debugger has stopped at a breakpoint).
236
Bram Moolenaar162b7142018-12-21 15:17:36 +0100237 The optional "group={group}" attribute can be used before
Bram Moolenaar58a7f872019-06-04 22:48:15 +0200238 "file=" to select a sign in a particular group. The optional
239 "priority={prio}" attribute can be used to change the priority
240 of an existing sign.
Bram Moolenaar162b7142018-12-21 15:17:36 +0100241
Bram Moolenaarc8cdf0f2021-03-13 13:28:13 +0100242 Example: >
243 :sign place 23 name=sign1 file=/path/to/edit.py
244<
Bram Moolenaarb328cca2019-01-06 16:24:01 +0100245:sign place {id} name={name} [buffer={nr}]
246 Same, but use buffer {nr}. If the buffer argument is not
247 given, use the current buffer.
Bram Moolenaar071d4272004-06-13 20:20:40 +0000248
Bram Moolenaarc8cdf0f2021-03-13 13:28:13 +0100249 Example: >
250 :sign place 23 name=sign1
251 :sign place 23 name=sign1 buffer=7
252<
Bram Moolenaar071d4272004-06-13 20:20:40 +0000253
254REMOVING SIGNS *:sign-unplace* *E159*
255
Bram Moolenaar162b7142018-12-21 15:17:36 +0100256See |sign_unplace()| for the equivalent Vim script function.
257
Bram Moolenaar071d4272004-06-13 20:20:40 +0000258:sign unplace {id} file={fname}
259 Remove the previously placed sign {id} from file {fname}.
260 See remark above about {fname} |:sign-fname|.
261
Bram Moolenaar162b7142018-12-21 15:17:36 +0100262:sign unplace {id} group={group} file={fname}
263 Same but remove the sign {id} in sign group {group}.
264
265:sign unplace {id} group=* file={fname}
266 Same but remove the sign {id} from all the sign groups.
267
Bram Moolenaarf65e5662012-07-10 15:18:22 +0200268:sign unplace * file={fname}
269 Remove all placed signs in file {fname}.
270
Bram Moolenaar162b7142018-12-21 15:17:36 +0100271:sign unplace * group={group} file={fname}
272 Remove all placed signs in group {group} from file {fname}.
273
274:sign unplace * group=* file={fname}
275 Remove all placed signs in all the groups from file {fname}.
276
Bram Moolenaar071d4272004-06-13 20:20:40 +0000277:sign unplace {id} buffer={nr}
Bram Moolenaarf65e5662012-07-10 15:18:22 +0200278 Remove the previously placed sign {id} from buffer {nr}.
279
Bram Moolenaar162b7142018-12-21 15:17:36 +0100280:sign unplace {id} group={group} buffer={nr}
281 Remove the previously placed sign {id} in group {group} from
282 buffer {nr}.
283
284:sign unplace {id} group=* buffer={nr}
285 Remove the previously placed sign {id} in all the groups from
286 buffer {nr}.
287
Bram Moolenaarf65e5662012-07-10 15:18:22 +0200288:sign unplace * buffer={nr}
289 Remove all placed signs in buffer {nr}.
Bram Moolenaar071d4272004-06-13 20:20:40 +0000290
Bram Moolenaar162b7142018-12-21 15:17:36 +0100291:sign unplace * group={group} buffer={nr}
292 Remove all placed signs in group {group} from buffer {nr}.
293
294:sign unplace * group=* buffer={nr}
295 Remove all placed signs in all the groups from buffer {nr}.
296
Bram Moolenaar071d4272004-06-13 20:20:40 +0000297:sign unplace {id}
298 Remove the previously placed sign {id} from all files it
299 appears in.
300
Bram Moolenaar162b7142018-12-21 15:17:36 +0100301:sign unplace {id} group={group}
302 Remove the previously placed sign {id} in group {group} from
303 all files it appears in.
304
305:sign unplace {id} group=*
306 Remove the previously placed sign {id} in all the groups from
307 all the files it appears in.
308
Bram Moolenaar071d4272004-06-13 20:20:40 +0000309:sign unplace *
Bram Moolenaar6b7b7192019-01-11 13:42:41 +0100310 Remove all placed signs in the global group from all the files.
Bram Moolenaar7d83bf42018-12-29 18:53:55 +0100311
312:sign unplace * group={group}
Bram Moolenaar6b7b7192019-01-11 13:42:41 +0100313 Remove all placed signs in group {group} from all the files.
Bram Moolenaar162b7142018-12-21 15:17:36 +0100314
315:sign unplace * group=*
Bram Moolenaar6b7b7192019-01-11 13:42:41 +0100316 Remove all placed signs in all the groups from all the files.
Bram Moolenaar071d4272004-06-13 20:20:40 +0000317
318:sign unplace
Bram Moolenaar7d83bf42018-12-29 18:53:55 +0100319 Remove a placed sign at the cursor position. If multiple signs
320 are placed in the line, then only one is removed.
321
322:sign unplace group={group}
323 Remove a placed sign in group {group} at the cursor
324 position.
325
326:sign unplace group=*
327 Remove a placed sign in any group at the cursor position.
Bram Moolenaar071d4272004-06-13 20:20:40 +0000328
329
Bram Moolenaar36782082013-11-28 13:53:34 +0100330LISTING PLACED SIGNS *:sign-place-list*
Bram Moolenaar071d4272004-06-13 20:20:40 +0000331
Bram Moolenaar162b7142018-12-21 15:17:36 +0100332See |sign_getplaced()| for the equivalent Vim script function.
333
Bram Moolenaar071d4272004-06-13 20:20:40 +0000334:sign place file={fname}
335 List signs placed in file {fname}.
336 See remark above about {fname} |:sign-fname|.
337
Bram Moolenaar162b7142018-12-21 15:17:36 +0100338:sign place group={group} file={fname}
339 List signs in group {group} placed in file {fname}.
340
Bram Moolenaar7d83bf42018-12-29 18:53:55 +0100341:sign place group=* file={fname}
342 List signs in all the groups placed in file {fname}.
343
Bram Moolenaar071d4272004-06-13 20:20:40 +0000344:sign place buffer={nr}
345 List signs placed in buffer {nr}.
346
Bram Moolenaar162b7142018-12-21 15:17:36 +0100347:sign place group={group} buffer={nr}
348 List signs in group {group} placed in buffer {nr}.
349
Bram Moolenaar7d83bf42018-12-29 18:53:55 +0100350:sign place group=* buffer={nr}
351 List signs in all the groups placed in buffer {nr}.
Bram Moolenaar071d4272004-06-13 20:20:40 +0000352
Bram Moolenaar7d83bf42018-12-29 18:53:55 +0100353:sign place List placed signs in the global group in all files.
Bram Moolenaarc8c88492018-12-27 23:59:26 +0100354
Bram Moolenaar162b7142018-12-21 15:17:36 +0100355:sign place group={group}
Bram Moolenaarc8c88492018-12-27 23:59:26 +0100356 List placed signs with sign group {group} in all files.
Bram Moolenaar162b7142018-12-21 15:17:36 +0100357
Bram Moolenaar7d83bf42018-12-29 18:53:55 +0100358:sign place group=*
359 List placed signs in all sign groups in all files.
360
Bram Moolenaar071d4272004-06-13 20:20:40 +0000361
362JUMPING TO A SIGN *:sign-jump* *E157*
363
Bram Moolenaar6b7b7192019-01-11 13:42:41 +0100364See |sign_jump()| for the equivalent Vim script function.
365
Bram Moolenaar071d4272004-06-13 20:20:40 +0000366:sign jump {id} file={fname}
367 Open the file {fname} or jump to the window that contains
368 {fname} and position the cursor at sign {id}.
369 See remark above about {fname} |:sign-fname|.
370 If the file isn't displayed in window and the current file can
371 not be |abandon|ed this fails.
372
Bram Moolenaar7d83bf42018-12-29 18:53:55 +0100373:sign jump {id} group={group} file={fname}
374 Same but jump to the sign in group {group}
375
Bram Moolenaarb328cca2019-01-06 16:24:01 +0100376:sign jump {id} [buffer={nr}] *E934*
Bram Moolenaar7571d552016-08-18 22:54:46 +0200377 Same, but use buffer {nr}. This fails if buffer {nr} does not
Bram Moolenaarb328cca2019-01-06 16:24:01 +0100378 have a name. If the buffer argument is not given, use the
379 current buffer.
Bram Moolenaar7571d552016-08-18 22:54:46 +0200380
Bram Moolenaarb328cca2019-01-06 16:24:01 +0100381:sign jump {id} group={group} [buffer={nr}]
Bram Moolenaar7d83bf42018-12-29 18:53:55 +0100382 Same but jump to the sign in group {group}
383
Bram Moolenaar071d4272004-06-13 20:20:40 +0000384
Bram Moolenaared997ad2019-07-21 16:42:00 +0200385==============================================================================
3863. Functions *sign-functions-details*
387
388sign_define({name} [, {dict}]) *sign_define()*
389sign_define({list})
390 Define a new sign named {name} or modify the attributes of an
391 existing sign. This is similar to the |:sign-define| command.
392
393 Prefix {name} with a unique text to avoid name collisions.
394 There is no {group} like with placing signs.
395
396 The {name} can be a String or a Number. The optional {dict}
397 argument specifies the sign attributes. The following values
398 are supported:
399 icon full path to the bitmap file for the sign.
400 linehl highlight group used for the whole line the
401 sign is placed in.
402 text text that is displayed when there is no icon
403 or the GUI is not being used.
404 texthl highlight group used for the text item
Bram Moolenaare413ea02021-11-24 16:20:13 +0000405 culhl highlight group used for the text item when
406 the cursor is on the same line as the sign and
407 'cursorline' is enabled.
Bram Moolenaared997ad2019-07-21 16:42:00 +0200408
409 If the sign named {name} already exists, then the attributes
410 of the sign are updated.
411
412 The one argument {list} can be used to define a list of signs.
413 Each list item is a dictionary with the above items in {dict}
Bram Moolenaar0c0734d2019-11-26 21:44:46 +0100414 and a "name" item for the sign name.
Bram Moolenaared997ad2019-07-21 16:42:00 +0200415
416 Returns 0 on success and -1 on failure. When the one argument
417 {list} is used, then returns a List of values one for each
418 defined sign.
419
420 Examples: >
421 call sign_define("mySign", {
422 \ "text" : "=>",
423 \ "texthl" : "Error",
424 \ "linehl" : "Search"})
425 call sign_define([
426 \ {'name' : 'sign1',
427 \ 'text' : '=>'},
428 \ {'name' : 'sign2',
429 \ 'text' : '!!'}
430 \ ])
431<
Bram Moolenaar93476fd2019-09-06 22:00:54 +0200432 Can also be used as a |method|: >
433 GetSignList()->sign_define()
434
Bram Moolenaared997ad2019-07-21 16:42:00 +0200435sign_getdefined([{name}]) *sign_getdefined()*
436 Get a list of defined signs and their attributes.
437 This is similar to the |:sign-list| command.
438
439 If the {name} is not supplied, then a list of all the defined
440 signs is returned. Otherwise the attribute of the specified
441 sign is returned.
442
443 Each list item in the returned value is a dictionary with the
444 following entries:
445 icon full path to the bitmap file of the sign
446 linehl highlight group used for the whole line the
447 sign is placed in.
448 name name of the sign
449 text text that is displayed when there is no icon
450 or the GUI is not being used.
451 texthl highlight group used for the text item
Bram Moolenaare413ea02021-11-24 16:20:13 +0000452 culhl highlight group used for the text item when
453 the cursor is on the same line as the sign and
454 'cursorline' is enabled.
Bram Moolenaared997ad2019-07-21 16:42:00 +0200455
456 Returns an empty List if there are no signs and when {name} is
457 not found.
458
459 Examples: >
460 " Get a list of all the defined signs
461 echo sign_getdefined()
462
463 " Get the attribute of the sign named mySign
464 echo sign_getdefined("mySign")
465<
Bram Moolenaar93476fd2019-09-06 22:00:54 +0200466 Can also be used as a |method|: >
467 GetSignList()->sign_getdefined()
468
Bram Moolenaar6aa57292021-08-14 21:25:52 +0200469sign_getplaced([{buf} [, {dict}]]) *sign_getplaced()*
Bram Moolenaared997ad2019-07-21 16:42:00 +0200470 Return a list of signs placed in a buffer or all the buffers.
471 This is similar to the |:sign-place-list| command.
472
Bram Moolenaar6aa57292021-08-14 21:25:52 +0200473 If the optional buffer name {buf} is specified, then only the
Bram Moolenaared997ad2019-07-21 16:42:00 +0200474 list of signs placed in that buffer is returned. For the use
Bram Moolenaar6aa57292021-08-14 21:25:52 +0200475 of {buf}, see |bufname()|. The optional {dict} can contain
Bram Moolenaared997ad2019-07-21 16:42:00 +0200476 the following entries:
477 group select only signs in this group
478 id select sign with this identifier
479 lnum select signs placed in this line. For the use
480 of {lnum}, see |line()|.
481 If {group} is '*', then signs in all the groups including the
482 global group are returned. If {group} is not supplied or is an
483 empty string, then only signs in the global group are
484 returned. If no arguments are supplied, then signs in the
485 global group placed in all the buffers are returned.
486 See |sign-group|.
487
488 Each list item in the returned value is a dictionary with the
489 following entries:
490 bufnr number of the buffer with the sign
491 signs list of signs placed in {bufnr}. Each list
492 item is a dictionary with the below listed
493 entries
494
495 The dictionary for each sign contains the following entries:
Bram Moolenaar3132cdd2020-11-05 20:41:49 +0100496 group sign group. Set to '' for the global group.
497 id identifier of the sign
498 lnum line number where the sign is placed
499 name name of the defined sign
500 priority sign priority
Bram Moolenaared997ad2019-07-21 16:42:00 +0200501
502 The returned signs in a buffer are ordered by their line
503 number and priority.
504
505 Returns an empty list on failure or if there are no placed
506 signs.
507
508 Examples: >
509 " Get a List of signs placed in eval.c in the
510 " global group
511 echo sign_getplaced("eval.c")
512
513 " Get a List of signs in group 'g1' placed in eval.c
514 echo sign_getplaced("eval.c", {'group' : 'g1'})
515
516 " Get a List of signs placed at line 10 in eval.c
517 echo sign_getplaced("eval.c", {'lnum' : 10})
518
519 " Get sign with identifier 10 placed in a.py
520 echo sign_getplaced("a.py", {'id' : 10})
521
522 " Get sign with id 20 in group 'g1' placed in a.py
523 echo sign_getplaced("a.py", {'group' : 'g1',
524 \ 'id' : 20})
525
526 " Get a List of all the placed signs
527 echo sign_getplaced()
528<
Bram Moolenaar93476fd2019-09-06 22:00:54 +0200529 Can also be used as a |method|: >
530 GetBufname()->sign_getplaced()
531<
Bram Moolenaared997ad2019-07-21 16:42:00 +0200532 *sign_jump()*
Bram Moolenaar6aa57292021-08-14 21:25:52 +0200533sign_jump({id}, {group}, {buf})
534 Open the buffer {buf} or jump to the window that contains
535 {buf} and position the cursor at sign {id} in group {group}.
Bram Moolenaared997ad2019-07-21 16:42:00 +0200536 This is similar to the |:sign-jump| command.
537
Yegappan Lakshmanan820d5522021-09-17 21:07:35 +0200538 If {group} is an empty string, then the global group is used.
Bram Moolenaar6aa57292021-08-14 21:25:52 +0200539 For the use of {buf}, see |bufname()|.
Bram Moolenaared997ad2019-07-21 16:42:00 +0200540
541 Returns the line number of the sign. Returns -1 if the
542 arguments are invalid.
543
544 Example: >
545 " Jump to sign 10 in the current buffer
546 call sign_jump(10, '', '')
547<
Bram Moolenaar93476fd2019-09-06 22:00:54 +0200548 Can also be used as a |method|: >
549 GetSignid()->sign_jump()
550<
Bram Moolenaared997ad2019-07-21 16:42:00 +0200551 *sign_place()*
Bram Moolenaar6aa57292021-08-14 21:25:52 +0200552sign_place({id}, {group}, {name}, {buf} [, {dict}])
Bram Moolenaared997ad2019-07-21 16:42:00 +0200553 Place the sign defined as {name} at line {lnum} in file or
Bram Moolenaar6aa57292021-08-14 21:25:52 +0200554 buffer {buf} and assign {id} and {group} to sign. This is
Bram Moolenaared997ad2019-07-21 16:42:00 +0200555 similar to the |:sign-place| command.
556
557 If the sign identifier {id} is zero, then a new identifier is
558 allocated. Otherwise the specified number is used. {group} is
559 the sign group name. To use the global sign group, use an
560 empty string. {group} functions as a namespace for {id}, thus
561 two groups can use the same IDs. Refer to |sign-identifier|
562 and |sign-group| for more information.
563
564 {name} refers to a defined sign.
Bram Moolenaar6aa57292021-08-14 21:25:52 +0200565 {buf} refers to a buffer name or number. For the accepted
Bram Moolenaared997ad2019-07-21 16:42:00 +0200566 values, see |bufname()|.
567
568 The optional {dict} argument supports the following entries:
569 lnum line number in the file or buffer
Bram Moolenaar6aa57292021-08-14 21:25:52 +0200570 {buf} where the sign is to be placed.
Bram Moolenaared997ad2019-07-21 16:42:00 +0200571 For the accepted values, see |line()|.
572 priority priority of the sign. See
573 |sign-priority| for more information.
574
575 If the optional {dict} is not specified, then it modifies the
576 placed sign {id} in group {group} to use the defined sign
577 {name}.
578
579 Returns the sign identifier on success and -1 on failure.
580
581 Examples: >
582 " Place a sign named sign1 with id 5 at line 20 in
583 " buffer json.c
584 call sign_place(5, '', 'sign1', 'json.c',
585 \ {'lnum' : 20})
586
587 " Updates sign 5 in buffer json.c to use sign2
588 call sign_place(5, '', 'sign2', 'json.c')
589
590 " Place a sign named sign3 at line 30 in
591 " buffer json.c with a new identifier
592 let id = sign_place(0, '', 'sign3', 'json.c',
593 \ {'lnum' : 30})
594
595 " Place a sign named sign4 with id 10 in group 'g3'
596 " at line 40 in buffer json.c with priority 90
597 call sign_place(10, 'g3', 'sign4', 'json.c',
598 \ {'lnum' : 40, 'priority' : 90})
599<
Bram Moolenaar93476fd2019-09-06 22:00:54 +0200600 Can also be used as a |method|: >
601 GetSignid()->sign_place(group, name, expr)
602<
Bram Moolenaared997ad2019-07-21 16:42:00 +0200603 *sign_placelist()*
604sign_placelist({list})
605 Place one or more signs. This is similar to the
606 |sign_place()| function. The {list} argument specifies the
607 List of signs to place. Each list item is a dict with the
608 following sign attributes:
609 buffer buffer name or number. For the accepted
610 values, see |bufname()|.
611 group sign group. {group} functions as a namespace
612 for {id}, thus two groups can use the same
613 IDs. If not specified or set to an empty
614 string, then the global group is used. See
615 |sign-group| for more information.
616 id sign identifier. If not specified or zero,
617 then a new unique identifier is allocated.
618 Otherwise the specified number is used. See
619 |sign-identifier| for more information.
620 lnum line number in the buffer {expr} where the
621 sign is to be placed. For the accepted values,
622 see |line()|.
623 name name of the sign to place. See |sign_define()|
624 for more information.
625 priority priority of the sign. When multiple signs are
626 placed on a line, the sign with the highest
627 priority is used. If not specified, the
628 default value of 10 is used. See
629 |sign-priority| for more information.
630
631 If {id} refers to an existing sign, then the existing sign is
632 modified to use the specified {name} and/or {priority}.
633
634 Returns a List of sign identifiers. If failed to place a
635 sign, the corresponding list item is set to -1.
636
637 Examples: >
638 " Place sign s1 with id 5 at line 20 and id 10 at line
639 " 30 in buffer a.c
640 let [n1, n2] = sign_placelist([
641 \ {'id' : 5,
642 \ 'name' : 's1',
643 \ 'buffer' : 'a.c',
644 \ 'lnum' : 20},
645 \ {'id' : 10,
646 \ 'name' : 's1',
647 \ 'buffer' : 'a.c',
648 \ 'lnum' : 30}
649 \ ])
650
651 " Place sign s1 in buffer a.c at line 40 and 50
652 " with auto-generated identifiers
653 let [n1, n2] = sign_placelist([
654 \ {'name' : 's1',
655 \ 'buffer' : 'a.c',
656 \ 'lnum' : 40},
657 \ {'name' : 's1',
658 \ 'buffer' : 'a.c',
659 \ 'lnum' : 50}
660 \ ])
661<
Bram Moolenaar93476fd2019-09-06 22:00:54 +0200662 Can also be used as a |method|: >
663 GetSignlist()->sign_placelist()
Bram Moolenaared997ad2019-07-21 16:42:00 +0200664
665sign_undefine([{name}]) *sign_undefine()*
666sign_undefine({list})
667 Deletes a previously defined sign {name}. This is similar to
668 the |:sign-undefine| command. If {name} is not supplied, then
669 deletes all the defined signs.
670
671 The one argument {list} can be used to undefine a list of
672 signs. Each list item is the name of a sign.
673
674 Returns 0 on success and -1 on failure. For the one argument
675 {list} call, returns a list of values one for each undefined
676 sign.
677
678 Examples: >
679 " Delete a sign named mySign
680 call sign_undefine("mySign")
681
682 " Delete signs 'sign1' and 'sign2'
683 call sign_undefine(["sign1", "sign2"])
684
685 " Delete all the signs
686 call sign_undefine()
687<
Bram Moolenaar93476fd2019-09-06 22:00:54 +0200688 Can also be used as a |method|: >
689 GetSignlist()->sign_undefine()
Bram Moolenaared997ad2019-07-21 16:42:00 +0200690
691sign_unplace({group} [, {dict}]) *sign_unplace()*
692 Remove a previously placed sign in one or more buffers. This
693 is similar to the |:sign-unplace| command.
694
695 {group} is the sign group name. To use the global sign group,
696 use an empty string. If {group} is set to '*', then all the
697 groups including the global group are used.
698 The signs in {group} are selected based on the entries in
699 {dict}. The following optional entries in {dict} are
700 supported:
701 buffer buffer name or number. See |bufname()|.
702 id sign identifier
703 If {dict} is not supplied, then all the signs in {group} are
704 removed.
705
706 Returns 0 on success and -1 on failure.
707
708 Examples: >
709 " Remove sign 10 from buffer a.vim
710 call sign_unplace('', {'buffer' : "a.vim", 'id' : 10})
711
712 " Remove sign 20 in group 'g1' from buffer 3
713 call sign_unplace('g1', {'buffer' : 3, 'id' : 20})
714
715 " Remove all the signs in group 'g2' from buffer 10
716 call sign_unplace('g2', {'buffer' : 10})
717
718 " Remove sign 30 in group 'g3' from all the buffers
719 call sign_unplace('g3', {'id' : 30})
720
721 " Remove all the signs placed in buffer 5
722 call sign_unplace('*', {'buffer' : 5})
723
724 " Remove the signs in group 'g4' from all the buffers
725 call sign_unplace('g4')
726
727 " Remove sign 40 from all the buffers
728 call sign_unplace('*', {'id' : 40})
729
730 " Remove all the placed signs from all the buffers
731 call sign_unplace('*')
Bram Moolenaar93476fd2019-09-06 22:00:54 +0200732
733< Can also be used as a |method|: >
734 GetSigngroup()->sign_unplace()
Bram Moolenaared997ad2019-07-21 16:42:00 +0200735<
736sign_unplacelist({list}) *sign_unplacelist()*
737 Remove previously placed signs from one or more buffers. This
738 is similar to the |sign_unplace()| function.
739
740 The {list} argument specifies the List of signs to remove.
741 Each list item is a dict with the following sign attributes:
742 buffer buffer name or number. For the accepted
743 values, see |bufname()|. If not specified,
744 then the specified sign is removed from all
745 the buffers.
746 group sign group name. If not specified or set to an
747 empty string, then the global sign group is
748 used. If set to '*', then all the groups
749 including the global group are used.
750 id sign identifier. If not specified, then all
751 the signs in the specified group are removed.
752
753 Returns a List where an entry is set to 0 if the corresponding
754 sign was successfully removed or -1 on failure.
755
756 Example: >
757 " Remove sign with id 10 from buffer a.vim and sign
758 " with id 20 from buffer b.vim
759 call sign_unplacelist([
760 \ {'id' : 10, 'buffer' : "a.vim"},
761 \ {'id' : 20, 'buffer' : 'b.vim'},
762 \ ])
763<
Bram Moolenaar93476fd2019-09-06 22:00:54 +0200764 Can also be used as a |method|: >
765 GetSignlist()->sign_unplacelist()
766<
Bram Moolenaared997ad2019-07-21 16:42:00 +0200767
Bram Moolenaar91f84f62018-07-29 15:07:52 +0200768 vim:tw=78:ts=8:noet:ft=help:norl: