blob: 0e858d65454d16586883239b927d963f437871c0 [file] [log] [blame]
Bram Moolenaared997ad2019-07-21 16:42:00 +02001*sign.txt* For Vim version 8.1. Last change: 2019 Jul 21
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
51The color of the column is set with the SignColumn group |hl-SignColumn|.
52Example 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 Moolenaarb328cca2019-01-06 16:24:01 +010056 *sign-identifier*
57Each placed sign is identified by a number called the sign identifier. This
58identifier is used to jump to the sign or to remove the sign. The identifier
Bram Moolenaard09091d2019-01-17 16:07:22 +010059is assigned when placing the sign using the |:sign-place| command or the
Bram Moolenaarb328cca2019-01-06 16:24:01 +010060|sign_place()| function. Each sign identifier should be a unique number. If
61multiple placed signs use the same identifier, then jumping to or removing a
62sign becomes unpredictable. To avoid overlapping identifiers, sign groups can
63be used. The |sign_place()| function can be called with a zero sign identifier
64to allocate the next available identifier.
65
Bram Moolenaar162b7142018-12-21 15:17:36 +010066 *sign-group*
Bram Moolenaarb328cca2019-01-06 16:24:01 +010067Each placed sign can be assigned to either the global group or a named group.
68When placing a sign, if a group name is not supplied, or an empty string is
69used, then the sign is placed in the global group. Otherwise the sign is
70placed in the named group. The sign identifier is unique within a group. The
71sign group allows Vim plugins to use unique signs without interfering with
72other plugins using signs.
Bram Moolenaar162b7142018-12-21 15:17:36 +010073
74 *sign-priority*
75Each placed sign is assigned a priority value. When multiple signs are placed
76on the same line, the attributes of the sign with the highest priority is used
77independent of the sign group. The default priority for a sign is 10. The
78priority is assigned at the time of placing a sign.
Bram Moolenaar071d4272004-06-13 20:20:40 +000079
Bram Moolenaard09091d2019-01-17 16:07:22 +010080When the line on which the sign is placed is deleted, the sign is moved to the
81next line (or the last line of the buffer, if there is no next line). When
82the delete is undone the sign does not move back.
83
Bram Moolenaar071d4272004-06-13 20:20:40 +000084==============================================================================
852. Commands *sign-commands* *:sig* *:sign*
86
Bram Moolenaar00a927d2010-05-14 23:24:24 +020087Here is an example that places a sign "piet", displayed with the text ">>", in
Bram Moolenaar071d4272004-06-13 20:20:40 +000088line 23 of the current file: >
89 :sign define piet text=>> texthl=Search
90 :exe ":sign place 2 line=23 name=piet file=" . expand("%:p")
91
92And here is the command to delete it again: >
93 :sign unplace 2
94
95Note that the ":sign" command cannot be followed by another command or a
96comment. If you do need that, use the |:execute| command.
97
98
99DEFINING A SIGN. *:sign-define* *E255* *E160* *E612*
100
Bram Moolenaar162b7142018-12-21 15:17:36 +0100101See |sign_define()| for the equivalent Vim script function.
102
Bram Moolenaar071d4272004-06-13 20:20:40 +0000103:sign define {name} {argument}...
104 Define a new sign or set attributes for an existing sign.
105 The {name} can either be a number (all digits) or a name
Bram Moolenaar4c05fa02019-01-01 15:32:17 +0100106 starting with a non-digit. Leading zeros are ignored, thus
Bram Moolenaar483c5d82010-10-20 18:45:33 +0200107 "0012", "012" and "12" are considered the same name.
Bram Moolenaar071d4272004-06-13 20:20:40 +0000108 About 120 different signs can be defined.
109
110 Accepted arguments:
111
Bram Moolenaar6ee8d892012-01-10 14:55:01 +0100112 icon={bitmap}
Bram Moolenaar071d4272004-06-13 20:20:40 +0000113 Define the file name where the bitmap can be found. Should be
114 a full path. The bitmap should fit in the place of two
115 characters. This is not checked. If the bitmap is too big it
116 will cause redraw problems. Only GTK 2 can scale the bitmap
117 to fit the space available.
118 toolkit supports ~
119 GTK 1 pixmap (.xpm)
120 GTK 2 many
121 Motif pixmap (.xpm)
Bram Moolenaar6ee8d892012-01-10 14:55:01 +0100122 Win32 .bmp, .ico, .cur
123 pixmap (.xpm) |+xpm_w32|
Bram Moolenaar071d4272004-06-13 20:20:40 +0000124
125 linehl={group}
126 Highlighting group used for the whole line the sign is placed
127 in. Most useful is defining a background color.
128
129 text={text} *E239*
130 Define the text that is displayed when there is no icon or the
131 GUI is not being used. Only printable characters are allowed
132 and they must occupy one or two display cells.
133
134 texthl={group}
135 Highlighting group used for the text item.
136
137
138DELETING A SIGN *:sign-undefine* *E155*
139
Bram Moolenaar162b7142018-12-21 15:17:36 +0100140See |sign_undefine()| for the equivalent Vim script function.
141
Bram Moolenaar071d4272004-06-13 20:20:40 +0000142:sign undefine {name}
143 Deletes a previously defined sign. If signs with this {name}
144 are still placed this will cause trouble.
145
146
Bram Moolenaar162b7142018-12-21 15:17:36 +0100147
Bram Moolenaar071d4272004-06-13 20:20:40 +0000148LISTING SIGNS *:sign-list* *E156*
149
Bram Moolenaar162b7142018-12-21 15:17:36 +0100150See |sign_getdefined()| for the equivalent Vim script function.
151
Bram Moolenaar071d4272004-06-13 20:20:40 +0000152:sign list Lists all defined signs and their attributes.
153
154:sign list {name}
155 Lists one defined sign and its attributes.
156
157
158PLACING SIGNS *:sign-place* *E158*
159
Bram Moolenaar162b7142018-12-21 15:17:36 +0100160See |sign_place()| for the equivalent Vim script function.
161
Bram Moolenaar071d4272004-06-13 20:20:40 +0000162:sign place {id} line={lnum} name={name} file={fname}
163 Place sign defined as {name} at line {lnum} in file {fname}.
164 *:sign-fname*
165 The file {fname} must already be loaded in a buffer. The
166 exact file name must be used, wildcards, $ENV and ~ are not
167 expanded, white space must not be escaped. Trailing white
168 space is ignored.
169
170 The sign is remembered under {id}, this can be used for
171 further manipulation. {id} must be a number.
172 It's up to the user to make sure the {id} is used only once in
173 each file (if it's used several times unplacing will also have
174 to be done several times and making changes may not work as
175 expected).
176
Bram Moolenaar162b7142018-12-21 15:17:36 +0100177 The following optional sign attributes can be specified before
178 "file=":
179 group={group} Place sign in sign group {group}
180 priority={prio} Assign priority {prio} to sign
181
182 By default, the sign is placed in the global sign group.
183
184 By default, the sign is assigned a default priority of 10. To
185 assign a different priority value, use "priority={prio}" to
Bram Moolenaar58a7f872019-06-04 22:48:15 +0200186 specify a value. The priority is used to determine the sign
187 that is displayed when multiple signs are placed on the same
188 line.
Bram Moolenaar162b7142018-12-21 15:17:36 +0100189
190 Examples: >
191 :sign place 5 line=3 name=sign1 file=a.py
192 :sign place 6 group=g2 line=2 name=sign2 file=x.py
193 :sign place 9 group=g2 priority=50 line=5
194 \ name=sign1 file=a.py
195<
Bram Moolenaarb328cca2019-01-06 16:24:01 +0100196:sign place {id} line={lnum} name={name} [buffer={nr}]
197 Same, but use buffer {nr}. If the buffer argument is not
198 given, place the sign in the current buffer.
Bram Moolenaar071d4272004-06-13 20:20:40 +0000199
Bram Moolenaare968e362014-05-13 20:23:24 +0200200 *E885*
Bram Moolenaar071d4272004-06-13 20:20:40 +0000201:sign place {id} name={name} file={fname}
202 Change the placed sign {id} in file {fname} to use the defined
203 sign {name}. See remark above about {fname} |:sign-fname|.
204 This can be used to change the displayed sign without moving
205 it (e.g., when the debugger has stopped at a breakpoint).
206
Bram Moolenaar162b7142018-12-21 15:17:36 +0100207 The optional "group={group}" attribute can be used before
Bram Moolenaar58a7f872019-06-04 22:48:15 +0200208 "file=" to select a sign in a particular group. The optional
209 "priority={prio}" attribute can be used to change the priority
210 of an existing sign.
Bram Moolenaar162b7142018-12-21 15:17:36 +0100211
Bram Moolenaarb328cca2019-01-06 16:24:01 +0100212:sign place {id} name={name} [buffer={nr}]
213 Same, but use buffer {nr}. If the buffer argument is not
214 given, use the current buffer.
Bram Moolenaar071d4272004-06-13 20:20:40 +0000215
216
217REMOVING SIGNS *:sign-unplace* *E159*
218
Bram Moolenaar162b7142018-12-21 15:17:36 +0100219See |sign_unplace()| for the equivalent Vim script function.
220
Bram Moolenaar071d4272004-06-13 20:20:40 +0000221:sign unplace {id} file={fname}
222 Remove the previously placed sign {id} from file {fname}.
223 See remark above about {fname} |:sign-fname|.
224
Bram Moolenaar162b7142018-12-21 15:17:36 +0100225:sign unplace {id} group={group} file={fname}
226 Same but remove the sign {id} in sign group {group}.
227
228:sign unplace {id} group=* file={fname}
229 Same but remove the sign {id} from all the sign groups.
230
Bram Moolenaarf65e5662012-07-10 15:18:22 +0200231:sign unplace * file={fname}
232 Remove all placed signs in file {fname}.
233
Bram Moolenaar162b7142018-12-21 15:17:36 +0100234:sign unplace * group={group} file={fname}
235 Remove all placed signs in group {group} from file {fname}.
236
237:sign unplace * group=* file={fname}
238 Remove all placed signs in all the groups from file {fname}.
239
Bram Moolenaar071d4272004-06-13 20:20:40 +0000240:sign unplace {id} buffer={nr}
Bram Moolenaarf65e5662012-07-10 15:18:22 +0200241 Remove the previously placed sign {id} from buffer {nr}.
242
Bram Moolenaar162b7142018-12-21 15:17:36 +0100243:sign unplace {id} group={group} buffer={nr}
244 Remove the previously placed sign {id} in group {group} from
245 buffer {nr}.
246
247:sign unplace {id} group=* buffer={nr}
248 Remove the previously placed sign {id} in all the groups from
249 buffer {nr}.
250
Bram Moolenaarf65e5662012-07-10 15:18:22 +0200251:sign unplace * buffer={nr}
252 Remove all placed signs in buffer {nr}.
Bram Moolenaar071d4272004-06-13 20:20:40 +0000253
Bram Moolenaar162b7142018-12-21 15:17:36 +0100254:sign unplace * group={group} buffer={nr}
255 Remove all placed signs in group {group} from buffer {nr}.
256
257:sign unplace * group=* buffer={nr}
258 Remove all placed signs in all the groups from buffer {nr}.
259
Bram Moolenaar071d4272004-06-13 20:20:40 +0000260:sign unplace {id}
261 Remove the previously placed sign {id} from all files it
262 appears in.
263
Bram Moolenaar162b7142018-12-21 15:17:36 +0100264:sign unplace {id} group={group}
265 Remove the previously placed sign {id} in group {group} from
266 all files it appears in.
267
268:sign unplace {id} group=*
269 Remove the previously placed sign {id} in all the groups from
270 all the files it appears in.
271
Bram Moolenaar071d4272004-06-13 20:20:40 +0000272:sign unplace *
Bram Moolenaar6b7b7192019-01-11 13:42:41 +0100273 Remove all placed signs in the global group from all the files.
Bram Moolenaar7d83bf42018-12-29 18:53:55 +0100274
275:sign unplace * group={group}
Bram Moolenaar6b7b7192019-01-11 13:42:41 +0100276 Remove all placed signs in group {group} from all the files.
Bram Moolenaar162b7142018-12-21 15:17:36 +0100277
278:sign unplace * group=*
Bram Moolenaar6b7b7192019-01-11 13:42:41 +0100279 Remove all placed signs in all the groups from all the files.
Bram Moolenaar071d4272004-06-13 20:20:40 +0000280
281:sign unplace
Bram Moolenaar7d83bf42018-12-29 18:53:55 +0100282 Remove a placed sign at the cursor position. If multiple signs
283 are placed in the line, then only one is removed.
284
285:sign unplace group={group}
286 Remove a placed sign in group {group} at the cursor
287 position.
288
289:sign unplace group=*
290 Remove a placed sign in any group at the cursor position.
Bram Moolenaar071d4272004-06-13 20:20:40 +0000291
292
Bram Moolenaar36782082013-11-28 13:53:34 +0100293LISTING PLACED SIGNS *:sign-place-list*
Bram Moolenaar071d4272004-06-13 20:20:40 +0000294
Bram Moolenaar162b7142018-12-21 15:17:36 +0100295See |sign_getplaced()| for the equivalent Vim script function.
296
Bram Moolenaar071d4272004-06-13 20:20:40 +0000297:sign place file={fname}
298 List signs placed in file {fname}.
299 See remark above about {fname} |:sign-fname|.
300
Bram Moolenaar162b7142018-12-21 15:17:36 +0100301:sign place group={group} file={fname}
302 List signs in group {group} placed in file {fname}.
303
Bram Moolenaar7d83bf42018-12-29 18:53:55 +0100304:sign place group=* file={fname}
305 List signs in all the groups placed in file {fname}.
306
Bram Moolenaar071d4272004-06-13 20:20:40 +0000307:sign place buffer={nr}
308 List signs placed in buffer {nr}.
309
Bram Moolenaar162b7142018-12-21 15:17:36 +0100310:sign place group={group} buffer={nr}
311 List signs in group {group} placed in buffer {nr}.
312
Bram Moolenaar7d83bf42018-12-29 18:53:55 +0100313:sign place group=* buffer={nr}
314 List signs in all the groups placed in buffer {nr}.
Bram Moolenaar071d4272004-06-13 20:20:40 +0000315
Bram Moolenaar7d83bf42018-12-29 18:53:55 +0100316:sign place List placed signs in the global group in all files.
Bram Moolenaarc8c88492018-12-27 23:59:26 +0100317
Bram Moolenaar162b7142018-12-21 15:17:36 +0100318:sign place group={group}
Bram Moolenaarc8c88492018-12-27 23:59:26 +0100319 List placed signs with sign group {group} in all files.
Bram Moolenaar162b7142018-12-21 15:17:36 +0100320
Bram Moolenaar7d83bf42018-12-29 18:53:55 +0100321:sign place group=*
322 List placed signs in all sign groups in all files.
323
Bram Moolenaar071d4272004-06-13 20:20:40 +0000324
325JUMPING TO A SIGN *:sign-jump* *E157*
326
Bram Moolenaar6b7b7192019-01-11 13:42:41 +0100327See |sign_jump()| for the equivalent Vim script function.
328
Bram Moolenaar071d4272004-06-13 20:20:40 +0000329:sign jump {id} file={fname}
330 Open the file {fname} or jump to the window that contains
331 {fname} and position the cursor at sign {id}.
332 See remark above about {fname} |:sign-fname|.
333 If the file isn't displayed in window and the current file can
334 not be |abandon|ed this fails.
335
Bram Moolenaar7d83bf42018-12-29 18:53:55 +0100336:sign jump {id} group={group} file={fname}
337 Same but jump to the sign in group {group}
338
Bram Moolenaarb328cca2019-01-06 16:24:01 +0100339:sign jump {id} [buffer={nr}] *E934*
Bram Moolenaar7571d552016-08-18 22:54:46 +0200340 Same, but use buffer {nr}. This fails if buffer {nr} does not
Bram Moolenaarb328cca2019-01-06 16:24:01 +0100341 have a name. If the buffer argument is not given, use the
342 current buffer.
Bram Moolenaar7571d552016-08-18 22:54:46 +0200343
Bram Moolenaarb328cca2019-01-06 16:24:01 +0100344:sign jump {id} group={group} [buffer={nr}]
Bram Moolenaar7d83bf42018-12-29 18:53:55 +0100345 Same but jump to the sign in group {group}
346
Bram Moolenaar071d4272004-06-13 20:20:40 +0000347
Bram Moolenaared997ad2019-07-21 16:42:00 +0200348==============================================================================
3493. Functions *sign-functions-details*
350
351sign_define({name} [, {dict}]) *sign_define()*
352sign_define({list})
353 Define a new sign named {name} or modify the attributes of an
354 existing sign. This is similar to the |:sign-define| command.
355
356 Prefix {name} with a unique text to avoid name collisions.
357 There is no {group} like with placing signs.
358
359 The {name} can be a String or a Number. The optional {dict}
360 argument specifies the sign attributes. The following values
361 are supported:
362 icon full path to the bitmap file for the sign.
363 linehl highlight group used for the whole line the
364 sign is placed in.
365 text text that is displayed when there is no icon
366 or the GUI is not being used.
367 texthl highlight group used for the text item
368
369 If the sign named {name} already exists, then the attributes
370 of the sign are updated.
371
372 The one argument {list} can be used to define a list of signs.
373 Each list item is a dictionary with the above items in {dict}
374 and a 'name' item for the sign name.
375
376 Returns 0 on success and -1 on failure. When the one argument
377 {list} is used, then returns a List of values one for each
378 defined sign.
379
380 Examples: >
381 call sign_define("mySign", {
382 \ "text" : "=>",
383 \ "texthl" : "Error",
384 \ "linehl" : "Search"})
385 call sign_define([
386 \ {'name' : 'sign1',
387 \ 'text' : '=>'},
388 \ {'name' : 'sign2',
389 \ 'text' : '!!'}
390 \ ])
391<
392sign_getdefined([{name}]) *sign_getdefined()*
393 Get a list of defined signs and their attributes.
394 This is similar to the |:sign-list| command.
395
396 If the {name} is not supplied, then a list of all the defined
397 signs is returned. Otherwise the attribute of the specified
398 sign is returned.
399
400 Each list item in the returned value is a dictionary with the
401 following entries:
402 icon full path to the bitmap file of the sign
403 linehl highlight group used for the whole line the
404 sign is placed in.
405 name name of the sign
406 text text that is displayed when there is no icon
407 or the GUI is not being used.
408 texthl highlight group used for the text item
409
410 Returns an empty List if there are no signs and when {name} is
411 not found.
412
413 Examples: >
414 " Get a list of all the defined signs
415 echo sign_getdefined()
416
417 " Get the attribute of the sign named mySign
418 echo sign_getdefined("mySign")
419<
420sign_getplaced([{expr} [, {dict}]]) *sign_getplaced()*
421 Return a list of signs placed in a buffer or all the buffers.
422 This is similar to the |:sign-place-list| command.
423
424 If the optional buffer name {expr} is specified, then only the
425 list of signs placed in that buffer is returned. For the use
426 of {expr}, see |bufname()|. The optional {dict} can contain
427 the following entries:
428 group select only signs in this group
429 id select sign with this identifier
430 lnum select signs placed in this line. For the use
431 of {lnum}, see |line()|.
432 If {group} is '*', then signs in all the groups including the
433 global group are returned. If {group} is not supplied or is an
434 empty string, then only signs in the global group are
435 returned. If no arguments are supplied, then signs in the
436 global group placed in all the buffers are returned.
437 See |sign-group|.
438
439 Each list item in the returned value is a dictionary with the
440 following entries:
441 bufnr number of the buffer with the sign
442 signs list of signs placed in {bufnr}. Each list
443 item is a dictionary with the below listed
444 entries
445
446 The dictionary for each sign contains the following entries:
447 group sign group. Set to '' for the global group.
448 id identifier of the sign
449 lnum line number where the sign is placed
450 name name of the defined sign
451 priority sign priority
452
453 The returned signs in a buffer are ordered by their line
454 number and priority.
455
456 Returns an empty list on failure or if there are no placed
457 signs.
458
459 Examples: >
460 " Get a List of signs placed in eval.c in the
461 " global group
462 echo sign_getplaced("eval.c")
463
464 " Get a List of signs in group 'g1' placed in eval.c
465 echo sign_getplaced("eval.c", {'group' : 'g1'})
466
467 " Get a List of signs placed at line 10 in eval.c
468 echo sign_getplaced("eval.c", {'lnum' : 10})
469
470 " Get sign with identifier 10 placed in a.py
471 echo sign_getplaced("a.py", {'id' : 10})
472
473 " Get sign with id 20 in group 'g1' placed in a.py
474 echo sign_getplaced("a.py", {'group' : 'g1',
475 \ 'id' : 20})
476
477 " Get a List of all the placed signs
478 echo sign_getplaced()
479<
480 *sign_jump()*
481sign_jump({id}, {group}, {expr})
482 Open the buffer {expr} or jump to the window that contains
483 {expr} and position the cursor at sign {id} in group {group}.
484 This is similar to the |:sign-jump| command.
485
486 For the use of {expr}, see |bufname()|.
487
488 Returns the line number of the sign. Returns -1 if the
489 arguments are invalid.
490
491 Example: >
492 " Jump to sign 10 in the current buffer
493 call sign_jump(10, '', '')
494<
495
496 *sign_place()*
497sign_place({id}, {group}, {name}, {expr} [, {dict}])
498 Place the sign defined as {name} at line {lnum} in file or
499 buffer {expr} and assign {id} and {group} to sign. This is
500 similar to the |:sign-place| command.
501
502 If the sign identifier {id} is zero, then a new identifier is
503 allocated. Otherwise the specified number is used. {group} is
504 the sign group name. To use the global sign group, use an
505 empty string. {group} functions as a namespace for {id}, thus
506 two groups can use the same IDs. Refer to |sign-identifier|
507 and |sign-group| for more information.
508
509 {name} refers to a defined sign.
510 {expr} refers to a buffer name or number. For the accepted
511 values, see |bufname()|.
512
513 The optional {dict} argument supports the following entries:
514 lnum line number in the file or buffer
515 {expr} where the sign is to be placed.
516 For the accepted values, see |line()|.
517 priority priority of the sign. See
518 |sign-priority| for more information.
519
520 If the optional {dict} is not specified, then it modifies the
521 placed sign {id} in group {group} to use the defined sign
522 {name}.
523
524 Returns the sign identifier on success and -1 on failure.
525
526 Examples: >
527 " Place a sign named sign1 with id 5 at line 20 in
528 " buffer json.c
529 call sign_place(5, '', 'sign1', 'json.c',
530 \ {'lnum' : 20})
531
532 " Updates sign 5 in buffer json.c to use sign2
533 call sign_place(5, '', 'sign2', 'json.c')
534
535 " Place a sign named sign3 at line 30 in
536 " buffer json.c with a new identifier
537 let id = sign_place(0, '', 'sign3', 'json.c',
538 \ {'lnum' : 30})
539
540 " Place a sign named sign4 with id 10 in group 'g3'
541 " at line 40 in buffer json.c with priority 90
542 call sign_place(10, 'g3', 'sign4', 'json.c',
543 \ {'lnum' : 40, 'priority' : 90})
544<
545
546 *sign_placelist()*
547sign_placelist({list})
548 Place one or more signs. This is similar to the
549 |sign_place()| function. The {list} argument specifies the
550 List of signs to place. Each list item is a dict with the
551 following sign attributes:
552 buffer buffer name or number. For the accepted
553 values, see |bufname()|.
554 group sign group. {group} functions as a namespace
555 for {id}, thus two groups can use the same
556 IDs. If not specified or set to an empty
557 string, then the global group is used. See
558 |sign-group| for more information.
559 id sign identifier. If not specified or zero,
560 then a new unique identifier is allocated.
561 Otherwise the specified number is used. See
562 |sign-identifier| for more information.
563 lnum line number in the buffer {expr} where the
564 sign is to be placed. For the accepted values,
565 see |line()|.
566 name name of the sign to place. See |sign_define()|
567 for more information.
568 priority priority of the sign. When multiple signs are
569 placed on a line, the sign with the highest
570 priority is used. If not specified, the
571 default value of 10 is used. See
572 |sign-priority| for more information.
573
574 If {id} refers to an existing sign, then the existing sign is
575 modified to use the specified {name} and/or {priority}.
576
577 Returns a List of sign identifiers. If failed to place a
578 sign, the corresponding list item is set to -1.
579
580 Examples: >
581 " Place sign s1 with id 5 at line 20 and id 10 at line
582 " 30 in buffer a.c
583 let [n1, n2] = sign_placelist([
584 \ {'id' : 5,
585 \ 'name' : 's1',
586 \ 'buffer' : 'a.c',
587 \ 'lnum' : 20},
588 \ {'id' : 10,
589 \ 'name' : 's1',
590 \ 'buffer' : 'a.c',
591 \ 'lnum' : 30}
592 \ ])
593
594 " Place sign s1 in buffer a.c at line 40 and 50
595 " with auto-generated identifiers
596 let [n1, n2] = sign_placelist([
597 \ {'name' : 's1',
598 \ 'buffer' : 'a.c',
599 \ 'lnum' : 40},
600 \ {'name' : 's1',
601 \ 'buffer' : 'a.c',
602 \ 'lnum' : 50}
603 \ ])
604<
605
606sign_undefine([{name}]) *sign_undefine()*
607sign_undefine({list})
608 Deletes a previously defined sign {name}. This is similar to
609 the |:sign-undefine| command. If {name} is not supplied, then
610 deletes all the defined signs.
611
612 The one argument {list} can be used to undefine a list of
613 signs. Each list item is the name of a sign.
614
615 Returns 0 on success and -1 on failure. For the one argument
616 {list} call, returns a list of values one for each undefined
617 sign.
618
619 Examples: >
620 " Delete a sign named mySign
621 call sign_undefine("mySign")
622
623 " Delete signs 'sign1' and 'sign2'
624 call sign_undefine(["sign1", "sign2"])
625
626 " Delete all the signs
627 call sign_undefine()
628<
629
630sign_unplace({group} [, {dict}]) *sign_unplace()*
631 Remove a previously placed sign in one or more buffers. This
632 is similar to the |:sign-unplace| command.
633
634 {group} is the sign group name. To use the global sign group,
635 use an empty string. If {group} is set to '*', then all the
636 groups including the global group are used.
637 The signs in {group} are selected based on the entries in
638 {dict}. The following optional entries in {dict} are
639 supported:
640 buffer buffer name or number. See |bufname()|.
641 id sign identifier
642 If {dict} is not supplied, then all the signs in {group} are
643 removed.
644
645 Returns 0 on success and -1 on failure.
646
647 Examples: >
648 " Remove sign 10 from buffer a.vim
649 call sign_unplace('', {'buffer' : "a.vim", 'id' : 10})
650
651 " Remove sign 20 in group 'g1' from buffer 3
652 call sign_unplace('g1', {'buffer' : 3, 'id' : 20})
653
654 " Remove all the signs in group 'g2' from buffer 10
655 call sign_unplace('g2', {'buffer' : 10})
656
657 " Remove sign 30 in group 'g3' from all the buffers
658 call sign_unplace('g3', {'id' : 30})
659
660 " Remove all the signs placed in buffer 5
661 call sign_unplace('*', {'buffer' : 5})
662
663 " Remove the signs in group 'g4' from all the buffers
664 call sign_unplace('g4')
665
666 " Remove sign 40 from all the buffers
667 call sign_unplace('*', {'id' : 40})
668
669 " Remove all the placed signs from all the buffers
670 call sign_unplace('*')
671<
672sign_unplacelist({list}) *sign_unplacelist()*
673 Remove previously placed signs from one or more buffers. This
674 is similar to the |sign_unplace()| function.
675
676 The {list} argument specifies the List of signs to remove.
677 Each list item is a dict with the following sign attributes:
678 buffer buffer name or number. For the accepted
679 values, see |bufname()|. If not specified,
680 then the specified sign is removed from all
681 the buffers.
682 group sign group name. If not specified or set to an
683 empty string, then the global sign group is
684 used. If set to '*', then all the groups
685 including the global group are used.
686 id sign identifier. If not specified, then all
687 the signs in the specified group are removed.
688
689 Returns a List where an entry is set to 0 if the corresponding
690 sign was successfully removed or -1 on failure.
691
692 Example: >
693 " Remove sign with id 10 from buffer a.vim and sign
694 " with id 20 from buffer b.vim
695 call sign_unplacelist([
696 \ {'id' : 10, 'buffer' : "a.vim"},
697 \ {'id' : 20, 'buffer' : 'b.vim'},
698 \ ])
699<
700
Bram Moolenaar91f84f62018-07-29 15:07:52 +0200701 vim:tw=78:ts=8:noet:ft=help:norl: