blob: 57bd0a76f10397771e1930fb6ac395240c1bf75f [file] [log] [blame]
Bram Moolenaar574ee7b2019-11-13 23:04:29 +01001*sign.txt* For Vim version 8.1. Last change: 2019 Nov 12
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 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
Bram Moolenaar574ee7b2019-11-13 23:04:29 +010074The group name "popupmenu" is used by popup windows where 'cursorline' is set.
75
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
83independent of the sign group. The default priority for a sign is 10. The
84priority is assigned at the time of placing a sign.
Bram Moolenaar071d4272004-06-13 20:20:40 +000085
Bram Moolenaard09091d2019-01-17 16:07:22 +010086When the line on which the sign is placed is deleted, the sign is moved to the
87next line (or the last line of the buffer, if there is no next line). When
88the delete is undone the sign does not move back.
89
Bram Moolenaar071d4272004-06-13 20:20:40 +000090==============================================================================
912. Commands *sign-commands* *:sig* *:sign*
92
Bram Moolenaar00a927d2010-05-14 23:24:24 +020093Here is an example that places a sign "piet", displayed with the text ">>", in
Bram Moolenaar071d4272004-06-13 20:20:40 +000094line 23 of the current file: >
95 :sign define piet text=>> texthl=Search
96 :exe ":sign place 2 line=23 name=piet file=" . expand("%:p")
97
98And here is the command to delete it again: >
99 :sign unplace 2
100
101Note that the ":sign" command cannot be followed by another command or a
102comment. If you do need that, use the |:execute| command.
103
104
105DEFINING A SIGN. *:sign-define* *E255* *E160* *E612*
106
Bram Moolenaar162b7142018-12-21 15:17:36 +0100107See |sign_define()| for the equivalent Vim script function.
108
Bram Moolenaar071d4272004-06-13 20:20:40 +0000109:sign define {name} {argument}...
110 Define a new sign or set attributes for an existing sign.
111 The {name} can either be a number (all digits) or a name
Bram Moolenaar4c05fa02019-01-01 15:32:17 +0100112 starting with a non-digit. Leading zeros are ignored, thus
Bram Moolenaar483c5d82010-10-20 18:45:33 +0200113 "0012", "012" and "12" are considered the same name.
Bram Moolenaar071d4272004-06-13 20:20:40 +0000114 About 120 different signs can be defined.
115
116 Accepted arguments:
117
Bram Moolenaar6ee8d892012-01-10 14:55:01 +0100118 icon={bitmap}
Bram Moolenaar071d4272004-06-13 20:20:40 +0000119 Define the file name where the bitmap can be found. Should be
120 a full path. The bitmap should fit in the place of two
121 characters. This is not checked. If the bitmap is too big it
122 will cause redraw problems. Only GTK 2 can scale the bitmap
123 to fit the space available.
124 toolkit supports ~
125 GTK 1 pixmap (.xpm)
126 GTK 2 many
127 Motif pixmap (.xpm)
Bram Moolenaar6ee8d892012-01-10 14:55:01 +0100128 Win32 .bmp, .ico, .cur
129 pixmap (.xpm) |+xpm_w32|
Bram Moolenaar071d4272004-06-13 20:20:40 +0000130
131 linehl={group}
132 Highlighting group used for the whole line the sign is placed
133 in. Most useful is defining a background color.
134
135 text={text} *E239*
136 Define the text that is displayed when there is no icon or the
137 GUI is not being used. Only printable characters are allowed
138 and they must occupy one or two display cells.
139
140 texthl={group}
141 Highlighting group used for the text item.
142
143
144DELETING A SIGN *:sign-undefine* *E155*
145
Bram Moolenaar162b7142018-12-21 15:17:36 +0100146See |sign_undefine()| for the equivalent Vim script function.
147
Bram Moolenaar071d4272004-06-13 20:20:40 +0000148:sign undefine {name}
149 Deletes a previously defined sign. If signs with this {name}
150 are still placed this will cause trouble.
151
152
Bram Moolenaar162b7142018-12-21 15:17:36 +0100153
Bram Moolenaar071d4272004-06-13 20:20:40 +0000154LISTING SIGNS *:sign-list* *E156*
155
Bram Moolenaar162b7142018-12-21 15:17:36 +0100156See |sign_getdefined()| for the equivalent Vim script function.
157
Bram Moolenaar071d4272004-06-13 20:20:40 +0000158:sign list Lists all defined signs and their attributes.
159
160:sign list {name}
161 Lists one defined sign and its attributes.
162
163
164PLACING SIGNS *:sign-place* *E158*
165
Bram Moolenaar162b7142018-12-21 15:17:36 +0100166See |sign_place()| for the equivalent Vim script function.
167
Bram Moolenaar071d4272004-06-13 20:20:40 +0000168:sign place {id} line={lnum} name={name} file={fname}
169 Place sign defined as {name} at line {lnum} in file {fname}.
170 *:sign-fname*
171 The file {fname} must already be loaded in a buffer. The
172 exact file name must be used, wildcards, $ENV and ~ are not
173 expanded, white space must not be escaped. Trailing white
174 space is ignored.
175
176 The sign is remembered under {id}, this can be used for
177 further manipulation. {id} must be a number.
178 It's up to the user to make sure the {id} is used only once in
179 each file (if it's used several times unplacing will also have
180 to be done several times and making changes may not work as
181 expected).
182
Bram Moolenaar162b7142018-12-21 15:17:36 +0100183 The following optional sign attributes can be specified before
184 "file=":
185 group={group} Place sign in sign group {group}
186 priority={prio} Assign priority {prio} to sign
187
188 By default, the sign is placed in the global sign group.
189
190 By default, the sign is assigned a default priority of 10. To
191 assign a different priority value, use "priority={prio}" to
Bram Moolenaar58a7f872019-06-04 22:48:15 +0200192 specify a value. The priority is used to determine the sign
193 that is displayed when multiple signs are placed on the same
194 line.
Bram Moolenaar162b7142018-12-21 15:17:36 +0100195
196 Examples: >
197 :sign place 5 line=3 name=sign1 file=a.py
198 :sign place 6 group=g2 line=2 name=sign2 file=x.py
199 :sign place 9 group=g2 priority=50 line=5
200 \ name=sign1 file=a.py
201<
Bram Moolenaarb328cca2019-01-06 16:24:01 +0100202:sign place {id} line={lnum} name={name} [buffer={nr}]
203 Same, but use buffer {nr}. If the buffer argument is not
204 given, place the sign in the current buffer.
Bram Moolenaar071d4272004-06-13 20:20:40 +0000205
Bram Moolenaare968e362014-05-13 20:23:24 +0200206 *E885*
Bram Moolenaar071d4272004-06-13 20:20:40 +0000207:sign place {id} name={name} file={fname}
208 Change the placed sign {id} in file {fname} to use the defined
209 sign {name}. See remark above about {fname} |:sign-fname|.
210 This can be used to change the displayed sign without moving
211 it (e.g., when the debugger has stopped at a breakpoint).
212
Bram Moolenaar162b7142018-12-21 15:17:36 +0100213 The optional "group={group}" attribute can be used before
Bram Moolenaar58a7f872019-06-04 22:48:15 +0200214 "file=" to select a sign in a particular group. The optional
215 "priority={prio}" attribute can be used to change the priority
216 of an existing sign.
Bram Moolenaar162b7142018-12-21 15:17:36 +0100217
Bram Moolenaarb328cca2019-01-06 16:24:01 +0100218:sign place {id} name={name} [buffer={nr}]
219 Same, but use buffer {nr}. If the buffer argument is not
220 given, use the current buffer.
Bram Moolenaar071d4272004-06-13 20:20:40 +0000221
222
223REMOVING SIGNS *:sign-unplace* *E159*
224
Bram Moolenaar162b7142018-12-21 15:17:36 +0100225See |sign_unplace()| for the equivalent Vim script function.
226
Bram Moolenaar071d4272004-06-13 20:20:40 +0000227:sign unplace {id} file={fname}
228 Remove the previously placed sign {id} from file {fname}.
229 See remark above about {fname} |:sign-fname|.
230
Bram Moolenaar162b7142018-12-21 15:17:36 +0100231:sign unplace {id} group={group} file={fname}
232 Same but remove the sign {id} in sign group {group}.
233
234:sign unplace {id} group=* file={fname}
235 Same but remove the sign {id} from all the sign groups.
236
Bram Moolenaarf65e5662012-07-10 15:18:22 +0200237:sign unplace * file={fname}
238 Remove all placed signs in file {fname}.
239
Bram Moolenaar162b7142018-12-21 15:17:36 +0100240:sign unplace * group={group} file={fname}
241 Remove all placed signs in group {group} from file {fname}.
242
243:sign unplace * group=* file={fname}
244 Remove all placed signs in all the groups from file {fname}.
245
Bram Moolenaar071d4272004-06-13 20:20:40 +0000246:sign unplace {id} buffer={nr}
Bram Moolenaarf65e5662012-07-10 15:18:22 +0200247 Remove the previously placed sign {id} from buffer {nr}.
248
Bram Moolenaar162b7142018-12-21 15:17:36 +0100249:sign unplace {id} group={group} buffer={nr}
250 Remove the previously placed sign {id} in group {group} from
251 buffer {nr}.
252
253:sign unplace {id} group=* buffer={nr}
254 Remove the previously placed sign {id} in all the groups from
255 buffer {nr}.
256
Bram Moolenaarf65e5662012-07-10 15:18:22 +0200257:sign unplace * buffer={nr}
258 Remove all placed signs in buffer {nr}.
Bram Moolenaar071d4272004-06-13 20:20:40 +0000259
Bram Moolenaar162b7142018-12-21 15:17:36 +0100260:sign unplace * group={group} buffer={nr}
261 Remove all placed signs in group {group} from buffer {nr}.
262
263:sign unplace * group=* buffer={nr}
264 Remove all placed signs in all the groups from buffer {nr}.
265
Bram Moolenaar071d4272004-06-13 20:20:40 +0000266:sign unplace {id}
267 Remove the previously placed sign {id} from all files it
268 appears in.
269
Bram Moolenaar162b7142018-12-21 15:17:36 +0100270:sign unplace {id} group={group}
271 Remove the previously placed sign {id} in group {group} from
272 all files it appears in.
273
274:sign unplace {id} group=*
275 Remove the previously placed sign {id} in all the groups from
276 all the files it appears in.
277
Bram Moolenaar071d4272004-06-13 20:20:40 +0000278:sign unplace *
Bram Moolenaar6b7b7192019-01-11 13:42:41 +0100279 Remove all placed signs in the global group from all the files.
Bram Moolenaar7d83bf42018-12-29 18:53:55 +0100280
281:sign unplace * group={group}
Bram Moolenaar6b7b7192019-01-11 13:42:41 +0100282 Remove all placed signs in group {group} from all the files.
Bram Moolenaar162b7142018-12-21 15:17:36 +0100283
284:sign unplace * group=*
Bram Moolenaar6b7b7192019-01-11 13:42:41 +0100285 Remove all placed signs in all the groups from all the files.
Bram Moolenaar071d4272004-06-13 20:20:40 +0000286
287:sign unplace
Bram Moolenaar7d83bf42018-12-29 18:53:55 +0100288 Remove a placed sign at the cursor position. If multiple signs
289 are placed in the line, then only one is removed.
290
291:sign unplace group={group}
292 Remove a placed sign in group {group} at the cursor
293 position.
294
295:sign unplace group=*
296 Remove a placed sign in any group at the cursor position.
Bram Moolenaar071d4272004-06-13 20:20:40 +0000297
298
Bram Moolenaar36782082013-11-28 13:53:34 +0100299LISTING PLACED SIGNS *:sign-place-list*
Bram Moolenaar071d4272004-06-13 20:20:40 +0000300
Bram Moolenaar162b7142018-12-21 15:17:36 +0100301See |sign_getplaced()| for the equivalent Vim script function.
302
Bram Moolenaar071d4272004-06-13 20:20:40 +0000303:sign place file={fname}
304 List signs placed in file {fname}.
305 See remark above about {fname} |:sign-fname|.
306
Bram Moolenaar162b7142018-12-21 15:17:36 +0100307:sign place group={group} file={fname}
308 List signs in group {group} placed in file {fname}.
309
Bram Moolenaar7d83bf42018-12-29 18:53:55 +0100310:sign place group=* file={fname}
311 List signs in all the groups placed in file {fname}.
312
Bram Moolenaar071d4272004-06-13 20:20:40 +0000313:sign place buffer={nr}
314 List signs placed in buffer {nr}.
315
Bram Moolenaar162b7142018-12-21 15:17:36 +0100316:sign place group={group} buffer={nr}
317 List signs in group {group} placed in buffer {nr}.
318
Bram Moolenaar7d83bf42018-12-29 18:53:55 +0100319:sign place group=* buffer={nr}
320 List signs in all the groups placed in buffer {nr}.
Bram Moolenaar071d4272004-06-13 20:20:40 +0000321
Bram Moolenaar7d83bf42018-12-29 18:53:55 +0100322:sign place List placed signs in the global group in all files.
Bram Moolenaarc8c88492018-12-27 23:59:26 +0100323
Bram Moolenaar162b7142018-12-21 15:17:36 +0100324:sign place group={group}
Bram Moolenaarc8c88492018-12-27 23:59:26 +0100325 List placed signs with sign group {group} in all files.
Bram Moolenaar162b7142018-12-21 15:17:36 +0100326
Bram Moolenaar7d83bf42018-12-29 18:53:55 +0100327:sign place group=*
328 List placed signs in all sign groups in all files.
329
Bram Moolenaar071d4272004-06-13 20:20:40 +0000330
331JUMPING TO A SIGN *:sign-jump* *E157*
332
Bram Moolenaar6b7b7192019-01-11 13:42:41 +0100333See |sign_jump()| for the equivalent Vim script function.
334
Bram Moolenaar071d4272004-06-13 20:20:40 +0000335:sign jump {id} file={fname}
336 Open the file {fname} or jump to the window that contains
337 {fname} and position the cursor at sign {id}.
338 See remark above about {fname} |:sign-fname|.
339 If the file isn't displayed in window and the current file can
340 not be |abandon|ed this fails.
341
Bram Moolenaar7d83bf42018-12-29 18:53:55 +0100342:sign jump {id} group={group} file={fname}
343 Same but jump to the sign in group {group}
344
Bram Moolenaarb328cca2019-01-06 16:24:01 +0100345:sign jump {id} [buffer={nr}] *E934*
Bram Moolenaar7571d552016-08-18 22:54:46 +0200346 Same, but use buffer {nr}. This fails if buffer {nr} does not
Bram Moolenaarb328cca2019-01-06 16:24:01 +0100347 have a name. If the buffer argument is not given, use the
348 current buffer.
Bram Moolenaar7571d552016-08-18 22:54:46 +0200349
Bram Moolenaarb328cca2019-01-06 16:24:01 +0100350:sign jump {id} group={group} [buffer={nr}]
Bram Moolenaar7d83bf42018-12-29 18:53:55 +0100351 Same but jump to the sign in group {group}
352
Bram Moolenaar071d4272004-06-13 20:20:40 +0000353
Bram Moolenaared997ad2019-07-21 16:42:00 +0200354==============================================================================
3553. Functions *sign-functions-details*
356
357sign_define({name} [, {dict}]) *sign_define()*
358sign_define({list})
359 Define a new sign named {name} or modify the attributes of an
360 existing sign. This is similar to the |:sign-define| command.
361
362 Prefix {name} with a unique text to avoid name collisions.
363 There is no {group} like with placing signs.
364
365 The {name} can be a String or a Number. The optional {dict}
366 argument specifies the sign attributes. The following values
367 are supported:
368 icon full path to the bitmap file for the sign.
369 linehl highlight group used for the whole line the
370 sign is placed in.
371 text text that is displayed when there is no icon
372 or the GUI is not being used.
373 texthl highlight group used for the text item
374
375 If the sign named {name} already exists, then the attributes
376 of the sign are updated.
377
378 The one argument {list} can be used to define a list of signs.
379 Each list item is a dictionary with the above items in {dict}
Bram Moolenaar0c0734d2019-11-26 21:44:46 +0100380 and a "name" item for the sign name.
Bram Moolenaared997ad2019-07-21 16:42:00 +0200381
382 Returns 0 on success and -1 on failure. When the one argument
383 {list} is used, then returns a List of values one for each
384 defined sign.
385
386 Examples: >
387 call sign_define("mySign", {
388 \ "text" : "=>",
389 \ "texthl" : "Error",
390 \ "linehl" : "Search"})
391 call sign_define([
392 \ {'name' : 'sign1',
393 \ 'text' : '=>'},
394 \ {'name' : 'sign2',
395 \ 'text' : '!!'}
396 \ ])
397<
Bram Moolenaar93476fd2019-09-06 22:00:54 +0200398 Can also be used as a |method|: >
399 GetSignList()->sign_define()
400
Bram Moolenaared997ad2019-07-21 16:42:00 +0200401sign_getdefined([{name}]) *sign_getdefined()*
402 Get a list of defined signs and their attributes.
403 This is similar to the |:sign-list| command.
404
405 If the {name} is not supplied, then a list of all the defined
406 signs is returned. Otherwise the attribute of the specified
407 sign is returned.
408
409 Each list item in the returned value is a dictionary with the
410 following entries:
411 icon full path to the bitmap file of the sign
412 linehl highlight group used for the whole line the
413 sign is placed in.
414 name name of the sign
415 text text that is displayed when there is no icon
416 or the GUI is not being used.
417 texthl highlight group used for the text item
418
419 Returns an empty List if there are no signs and when {name} is
420 not found.
421
422 Examples: >
423 " Get a list of all the defined signs
424 echo sign_getdefined()
425
426 " Get the attribute of the sign named mySign
427 echo sign_getdefined("mySign")
428<
Bram Moolenaar93476fd2019-09-06 22:00:54 +0200429 Can also be used as a |method|: >
430 GetSignList()->sign_getdefined()
431
Bram Moolenaared997ad2019-07-21 16:42:00 +0200432sign_getplaced([{expr} [, {dict}]]) *sign_getplaced()*
433 Return a list of signs placed in a buffer or all the buffers.
434 This is similar to the |:sign-place-list| command.
435
436 If the optional buffer name {expr} is specified, then only the
437 list of signs placed in that buffer is returned. For the use
438 of {expr}, see |bufname()|. The optional {dict} can contain
439 the following entries:
440 group select only signs in this group
441 id select sign with this identifier
442 lnum select signs placed in this line. For the use
443 of {lnum}, see |line()|.
444 If {group} is '*', then signs in all the groups including the
445 global group are returned. If {group} is not supplied or is an
446 empty string, then only signs in the global group are
447 returned. If no arguments are supplied, then signs in the
448 global group placed in all the buffers are returned.
449 See |sign-group|.
450
451 Each list item in the returned value is a dictionary with the
452 following entries:
453 bufnr number of the buffer with the sign
454 signs list of signs placed in {bufnr}. Each list
455 item is a dictionary with the below listed
456 entries
457
458 The dictionary for each sign contains the following entries:
459 group sign group. Set to '' for the global group.
460 id identifier of the sign
461 lnum line number where the sign is placed
462 name name of the defined sign
463 priority sign priority
464
465 The returned signs in a buffer are ordered by their line
466 number and priority.
467
468 Returns an empty list on failure or if there are no placed
469 signs.
470
471 Examples: >
472 " Get a List of signs placed in eval.c in the
473 " global group
474 echo sign_getplaced("eval.c")
475
476 " Get a List of signs in group 'g1' placed in eval.c
477 echo sign_getplaced("eval.c", {'group' : 'g1'})
478
479 " Get a List of signs placed at line 10 in eval.c
480 echo sign_getplaced("eval.c", {'lnum' : 10})
481
482 " Get sign with identifier 10 placed in a.py
483 echo sign_getplaced("a.py", {'id' : 10})
484
485 " Get sign with id 20 in group 'g1' placed in a.py
486 echo sign_getplaced("a.py", {'group' : 'g1',
487 \ 'id' : 20})
488
489 " Get a List of all the placed signs
490 echo sign_getplaced()
491<
Bram Moolenaar93476fd2019-09-06 22:00:54 +0200492 Can also be used as a |method|: >
493 GetBufname()->sign_getplaced()
494<
Bram Moolenaared997ad2019-07-21 16:42:00 +0200495 *sign_jump()*
496sign_jump({id}, {group}, {expr})
497 Open the buffer {expr} or jump to the window that contains
498 {expr} and position the cursor at sign {id} in group {group}.
499 This is similar to the |:sign-jump| command.
500
501 For the use of {expr}, see |bufname()|.
502
503 Returns the line number of the sign. Returns -1 if the
504 arguments are invalid.
505
506 Example: >
507 " Jump to sign 10 in the current buffer
508 call sign_jump(10, '', '')
509<
Bram Moolenaar93476fd2019-09-06 22:00:54 +0200510 Can also be used as a |method|: >
511 GetSignid()->sign_jump()
512<
Bram Moolenaared997ad2019-07-21 16:42:00 +0200513 *sign_place()*
514sign_place({id}, {group}, {name}, {expr} [, {dict}])
515 Place the sign defined as {name} at line {lnum} in file or
516 buffer {expr} and assign {id} and {group} to sign. This is
517 similar to the |:sign-place| command.
518
519 If the sign identifier {id} is zero, then a new identifier is
520 allocated. Otherwise the specified number is used. {group} is
521 the sign group name. To use the global sign group, use an
522 empty string. {group} functions as a namespace for {id}, thus
523 two groups can use the same IDs. Refer to |sign-identifier|
524 and |sign-group| for more information.
525
526 {name} refers to a defined sign.
527 {expr} refers to a buffer name or number. For the accepted
528 values, see |bufname()|.
529
530 The optional {dict} argument supports the following entries:
531 lnum line number in the file or buffer
532 {expr} where the sign is to be placed.
533 For the accepted values, see |line()|.
534 priority priority of the sign. See
535 |sign-priority| for more information.
536
537 If the optional {dict} is not specified, then it modifies the
538 placed sign {id} in group {group} to use the defined sign
539 {name}.
540
541 Returns the sign identifier on success and -1 on failure.
542
543 Examples: >
544 " Place a sign named sign1 with id 5 at line 20 in
545 " buffer json.c
546 call sign_place(5, '', 'sign1', 'json.c',
547 \ {'lnum' : 20})
548
549 " Updates sign 5 in buffer json.c to use sign2
550 call sign_place(5, '', 'sign2', 'json.c')
551
552 " Place a sign named sign3 at line 30 in
553 " buffer json.c with a new identifier
554 let id = sign_place(0, '', 'sign3', 'json.c',
555 \ {'lnum' : 30})
556
557 " Place a sign named sign4 with id 10 in group 'g3'
558 " at line 40 in buffer json.c with priority 90
559 call sign_place(10, 'g3', 'sign4', 'json.c',
560 \ {'lnum' : 40, 'priority' : 90})
561<
Bram Moolenaar93476fd2019-09-06 22:00:54 +0200562 Can also be used as a |method|: >
563 GetSignid()->sign_place(group, name, expr)
564<
Bram Moolenaared997ad2019-07-21 16:42:00 +0200565 *sign_placelist()*
566sign_placelist({list})
567 Place one or more signs. This is similar to the
568 |sign_place()| function. The {list} argument specifies the
569 List of signs to place. Each list item is a dict with the
570 following sign attributes:
571 buffer buffer name or number. For the accepted
572 values, see |bufname()|.
573 group sign group. {group} functions as a namespace
574 for {id}, thus two groups can use the same
575 IDs. If not specified or set to an empty
576 string, then the global group is used. See
577 |sign-group| for more information.
578 id sign identifier. If not specified or zero,
579 then a new unique identifier is allocated.
580 Otherwise the specified number is used. See
581 |sign-identifier| for more information.
582 lnum line number in the buffer {expr} where the
583 sign is to be placed. For the accepted values,
584 see |line()|.
585 name name of the sign to place. See |sign_define()|
586 for more information.
587 priority priority of the sign. When multiple signs are
588 placed on a line, the sign with the highest
589 priority is used. If not specified, the
590 default value of 10 is used. See
591 |sign-priority| for more information.
592
593 If {id} refers to an existing sign, then the existing sign is
594 modified to use the specified {name} and/or {priority}.
595
596 Returns a List of sign identifiers. If failed to place a
597 sign, the corresponding list item is set to -1.
598
599 Examples: >
600 " Place sign s1 with id 5 at line 20 and id 10 at line
601 " 30 in buffer a.c
602 let [n1, n2] = sign_placelist([
603 \ {'id' : 5,
604 \ 'name' : 's1',
605 \ 'buffer' : 'a.c',
606 \ 'lnum' : 20},
607 \ {'id' : 10,
608 \ 'name' : 's1',
609 \ 'buffer' : 'a.c',
610 \ 'lnum' : 30}
611 \ ])
612
613 " Place sign s1 in buffer a.c at line 40 and 50
614 " with auto-generated identifiers
615 let [n1, n2] = sign_placelist([
616 \ {'name' : 's1',
617 \ 'buffer' : 'a.c',
618 \ 'lnum' : 40},
619 \ {'name' : 's1',
620 \ 'buffer' : 'a.c',
621 \ 'lnum' : 50}
622 \ ])
623<
Bram Moolenaar93476fd2019-09-06 22:00:54 +0200624 Can also be used as a |method|: >
625 GetSignlist()->sign_placelist()
Bram Moolenaared997ad2019-07-21 16:42:00 +0200626
627sign_undefine([{name}]) *sign_undefine()*
628sign_undefine({list})
629 Deletes a previously defined sign {name}. This is similar to
630 the |:sign-undefine| command. If {name} is not supplied, then
631 deletes all the defined signs.
632
633 The one argument {list} can be used to undefine a list of
634 signs. Each list item is the name of a sign.
635
636 Returns 0 on success and -1 on failure. For the one argument
637 {list} call, returns a list of values one for each undefined
638 sign.
639
640 Examples: >
641 " Delete a sign named mySign
642 call sign_undefine("mySign")
643
644 " Delete signs 'sign1' and 'sign2'
645 call sign_undefine(["sign1", "sign2"])
646
647 " Delete all the signs
648 call sign_undefine()
649<
Bram Moolenaar93476fd2019-09-06 22:00:54 +0200650 Can also be used as a |method|: >
651 GetSignlist()->sign_undefine()
Bram Moolenaared997ad2019-07-21 16:42:00 +0200652
653sign_unplace({group} [, {dict}]) *sign_unplace()*
654 Remove a previously placed sign in one or more buffers. This
655 is similar to the |:sign-unplace| command.
656
657 {group} is the sign group name. To use the global sign group,
658 use an empty string. If {group} is set to '*', then all the
659 groups including the global group are used.
660 The signs in {group} are selected based on the entries in
661 {dict}. The following optional entries in {dict} are
662 supported:
663 buffer buffer name or number. See |bufname()|.
664 id sign identifier
665 If {dict} is not supplied, then all the signs in {group} are
666 removed.
667
668 Returns 0 on success and -1 on failure.
669
670 Examples: >
671 " Remove sign 10 from buffer a.vim
672 call sign_unplace('', {'buffer' : "a.vim", 'id' : 10})
673
674 " Remove sign 20 in group 'g1' from buffer 3
675 call sign_unplace('g1', {'buffer' : 3, 'id' : 20})
676
677 " Remove all the signs in group 'g2' from buffer 10
678 call sign_unplace('g2', {'buffer' : 10})
679
680 " Remove sign 30 in group 'g3' from all the buffers
681 call sign_unplace('g3', {'id' : 30})
682
683 " Remove all the signs placed in buffer 5
684 call sign_unplace('*', {'buffer' : 5})
685
686 " Remove the signs in group 'g4' from all the buffers
687 call sign_unplace('g4')
688
689 " Remove sign 40 from all the buffers
690 call sign_unplace('*', {'id' : 40})
691
692 " Remove all the placed signs from all the buffers
693 call sign_unplace('*')
Bram Moolenaar93476fd2019-09-06 22:00:54 +0200694
695< Can also be used as a |method|: >
696 GetSigngroup()->sign_unplace()
Bram Moolenaared997ad2019-07-21 16:42:00 +0200697<
698sign_unplacelist({list}) *sign_unplacelist()*
699 Remove previously placed signs from one or more buffers. This
700 is similar to the |sign_unplace()| function.
701
702 The {list} argument specifies the List of signs to remove.
703 Each list item is a dict with the following sign attributes:
704 buffer buffer name or number. For the accepted
705 values, see |bufname()|. If not specified,
706 then the specified sign is removed from all
707 the buffers.
708 group sign group name. If not specified or set to an
709 empty string, then the global sign group is
710 used. If set to '*', then all the groups
711 including the global group are used.
712 id sign identifier. If not specified, then all
713 the signs in the specified group are removed.
714
715 Returns a List where an entry is set to 0 if the corresponding
716 sign was successfully removed or -1 on failure.
717
718 Example: >
719 " Remove sign with id 10 from buffer a.vim and sign
720 " with id 20 from buffer b.vim
721 call sign_unplacelist([
722 \ {'id' : 10, 'buffer' : "a.vim"},
723 \ {'id' : 20, 'buffer' : 'b.vim'},
724 \ ])
725<
Bram Moolenaar93476fd2019-09-06 22:00:54 +0200726 Can also be used as a |method|: >
727 GetSignlist()->sign_unplacelist()
728<
Bram Moolenaared997ad2019-07-21 16:42:00 +0200729
Bram Moolenaar91f84f62018-07-29 15:07:52 +0200730 vim:tw=78:ts=8:noet:ft=help:norl: