blob: 46cb9b59c3de72c1ebd76c1b50bf7f35b1b9e6f1 [file] [log] [blame]
Bram Moolenaar39f7aa32020-08-31 22:00:05 +02001*sign.txt* For Vim version 8.2. Last change: 2020 Aug 31
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 Moolenaar72570732019-11-30 14:21:53 +010074To place a sign in a popup window the group name must start with "PopUp".
75Other signs will not show in a popup window. The group name "PopUpMenu" is
76used by popup windows where 'cursorline' is set.
77
Bram Moolenaar162b7142018-12-21 15:17:36 +010078 *sign-priority*
79Each placed sign is assigned a priority value. When multiple signs are placed
80on the same line, the attributes of the sign with the highest priority is used
Bram Moolenaar2547aa92020-07-26 17:00:44 +020081independently of the sign group. The default priority for a sign is 10. The
Bram Moolenaar162b7142018-12-21 15:17:36 +010082priority is assigned at the time of placing a sign.
Bram Moolenaar071d4272004-06-13 20:20:40 +000083
Bram Moolenaard09091d2019-01-17 16:07:22 +010084When the line on which the sign is placed is deleted, the sign is moved to the
85next line (or the last line of the buffer, if there is no next line). When
86the delete is undone the sign does not move back.
87
Bram Moolenaar39f7aa32020-08-31 22:00:05 +020088When a sign with line highlighting and 'cursorline' highlighting are both
89present, if the priority is 100 or more then the sign highlighting takes
90precedence, otherwise the 'cursorline' highlighting.
91
Bram Moolenaar071d4272004-06-13 20:20:40 +000092==============================================================================
932. Commands *sign-commands* *:sig* *:sign*
94
Bram Moolenaar00a927d2010-05-14 23:24:24 +020095Here is an example that places a sign "piet", displayed with the text ">>", in
Bram Moolenaar071d4272004-06-13 20:20:40 +000096line 23 of the current file: >
97 :sign define piet text=>> texthl=Search
98 :exe ":sign place 2 line=23 name=piet file=" . expand("%:p")
99
100And here is the command to delete it again: >
101 :sign unplace 2
102
103Note that the ":sign" command cannot be followed by another command or a
104comment. If you do need that, use the |:execute| command.
105
106
107DEFINING A SIGN. *:sign-define* *E255* *E160* *E612*
108
Bram Moolenaar162b7142018-12-21 15:17:36 +0100109See |sign_define()| for the equivalent Vim script function.
110
Bram Moolenaar071d4272004-06-13 20:20:40 +0000111:sign define {name} {argument}...
112 Define a new sign or set attributes for an existing sign.
113 The {name} can either be a number (all digits) or a name
Bram Moolenaar4c05fa02019-01-01 15:32:17 +0100114 starting with a non-digit. Leading zeros are ignored, thus
Bram Moolenaar483c5d82010-10-20 18:45:33 +0200115 "0012", "012" and "12" are considered the same name.
Bram Moolenaar071d4272004-06-13 20:20:40 +0000116 About 120 different signs can be defined.
117
118 Accepted arguments:
119
Bram Moolenaar6ee8d892012-01-10 14:55:01 +0100120 icon={bitmap}
Bram Moolenaar071d4272004-06-13 20:20:40 +0000121 Define the file name where the bitmap can be found. Should be
122 a full path. The bitmap should fit in the place of two
123 characters. This is not checked. If the bitmap is too big it
124 will cause redraw problems. Only GTK 2 can scale the bitmap
125 to fit the space available.
126 toolkit supports ~
127 GTK 1 pixmap (.xpm)
128 GTK 2 many
129 Motif pixmap (.xpm)
Bram Moolenaar6ee8d892012-01-10 14:55:01 +0100130 Win32 .bmp, .ico, .cur
131 pixmap (.xpm) |+xpm_w32|
Bram Moolenaar071d4272004-06-13 20:20:40 +0000132
133 linehl={group}
134 Highlighting group used for the whole line the sign is placed
135 in. Most useful is defining a background color.
136
137 text={text} *E239*
138 Define the text that is displayed when there is no icon or the
139 GUI is not being used. Only printable characters are allowed
140 and they must occupy one or two display cells.
141
142 texthl={group}
143 Highlighting group used for the text item.
144
145
146DELETING A SIGN *:sign-undefine* *E155*
147
Bram Moolenaar162b7142018-12-21 15:17:36 +0100148See |sign_undefine()| for the equivalent Vim script function.
149
Bram Moolenaar071d4272004-06-13 20:20:40 +0000150:sign undefine {name}
151 Deletes a previously defined sign. If signs with this {name}
152 are still placed this will cause trouble.
153
154
Bram Moolenaar162b7142018-12-21 15:17:36 +0100155
Bram Moolenaar071d4272004-06-13 20:20:40 +0000156LISTING SIGNS *:sign-list* *E156*
157
Bram Moolenaar162b7142018-12-21 15:17:36 +0100158See |sign_getdefined()| for the equivalent Vim script function.
159
Bram Moolenaar071d4272004-06-13 20:20:40 +0000160:sign list Lists all defined signs and their attributes.
161
162:sign list {name}
163 Lists one defined sign and its attributes.
164
165
166PLACING SIGNS *:sign-place* *E158*
167
Bram Moolenaar162b7142018-12-21 15:17:36 +0100168See |sign_place()| for the equivalent Vim script function.
169
Bram Moolenaar071d4272004-06-13 20:20:40 +0000170:sign place {id} line={lnum} name={name} file={fname}
171 Place sign defined as {name} at line {lnum} in file {fname}.
172 *:sign-fname*
173 The file {fname} must already be loaded in a buffer. The
174 exact file name must be used, wildcards, $ENV and ~ are not
175 expanded, white space must not be escaped. Trailing white
176 space is ignored.
177
178 The sign is remembered under {id}, this can be used for
179 further manipulation. {id} must be a number.
180 It's up to the user to make sure the {id} is used only once in
181 each file (if it's used several times unplacing will also have
182 to be done several times and making changes may not work as
183 expected).
184
Bram Moolenaar162b7142018-12-21 15:17:36 +0100185 The following optional sign attributes can be specified before
186 "file=":
187 group={group} Place sign in sign group {group}
188 priority={prio} Assign priority {prio} to sign
189
190 By default, the sign is placed in the global sign group.
191
192 By default, the sign is assigned a default priority of 10. To
193 assign a different priority value, use "priority={prio}" to
Bram Moolenaar58a7f872019-06-04 22:48:15 +0200194 specify a value. The priority is used to determine the sign
195 that is displayed when multiple signs are placed on the same
196 line.
Bram Moolenaar162b7142018-12-21 15:17:36 +0100197
198 Examples: >
199 :sign place 5 line=3 name=sign1 file=a.py
200 :sign place 6 group=g2 line=2 name=sign2 file=x.py
201 :sign place 9 group=g2 priority=50 line=5
202 \ name=sign1 file=a.py
203<
Bram Moolenaarb328cca2019-01-06 16:24:01 +0100204:sign place {id} line={lnum} name={name} [buffer={nr}]
205 Same, but use buffer {nr}. If the buffer argument is not
206 given, place the sign in the current buffer.
Bram Moolenaar071d4272004-06-13 20:20:40 +0000207
Bram Moolenaare968e362014-05-13 20:23:24 +0200208 *E885*
Bram Moolenaar071d4272004-06-13 20:20:40 +0000209:sign place {id} name={name} file={fname}
210 Change the placed sign {id} in file {fname} to use the defined
211 sign {name}. See remark above about {fname} |:sign-fname|.
212 This can be used to change the displayed sign without moving
213 it (e.g., when the debugger has stopped at a breakpoint).
214
Bram Moolenaar162b7142018-12-21 15:17:36 +0100215 The optional "group={group}" attribute can be used before
Bram Moolenaar58a7f872019-06-04 22:48:15 +0200216 "file=" to select a sign in a particular group. The optional
217 "priority={prio}" attribute can be used to change the priority
218 of an existing sign.
Bram Moolenaar162b7142018-12-21 15:17:36 +0100219
Bram Moolenaarb328cca2019-01-06 16:24:01 +0100220:sign place {id} name={name} [buffer={nr}]
221 Same, but use buffer {nr}. If the buffer argument is not
222 given, use the current buffer.
Bram Moolenaar071d4272004-06-13 20:20:40 +0000223
224
225REMOVING SIGNS *:sign-unplace* *E159*
226
Bram Moolenaar162b7142018-12-21 15:17:36 +0100227See |sign_unplace()| for the equivalent Vim script function.
228
Bram Moolenaar071d4272004-06-13 20:20:40 +0000229:sign unplace {id} file={fname}
230 Remove the previously placed sign {id} from file {fname}.
231 See remark above about {fname} |:sign-fname|.
232
Bram Moolenaar162b7142018-12-21 15:17:36 +0100233:sign unplace {id} group={group} file={fname}
234 Same but remove the sign {id} in sign group {group}.
235
236:sign unplace {id} group=* file={fname}
237 Same but remove the sign {id} from all the sign groups.
238
Bram Moolenaarf65e5662012-07-10 15:18:22 +0200239:sign unplace * file={fname}
240 Remove all placed signs in file {fname}.
241
Bram Moolenaar162b7142018-12-21 15:17:36 +0100242:sign unplace * group={group} file={fname}
243 Remove all placed signs in group {group} from file {fname}.
244
245:sign unplace * group=* file={fname}
246 Remove all placed signs in all the groups from file {fname}.
247
Bram Moolenaar071d4272004-06-13 20:20:40 +0000248:sign unplace {id} buffer={nr}
Bram Moolenaarf65e5662012-07-10 15:18:22 +0200249 Remove the previously placed sign {id} from buffer {nr}.
250
Bram Moolenaar162b7142018-12-21 15:17:36 +0100251:sign unplace {id} group={group} buffer={nr}
252 Remove the previously placed sign {id} in group {group} from
253 buffer {nr}.
254
255:sign unplace {id} group=* buffer={nr}
256 Remove the previously placed sign {id} in all the groups from
257 buffer {nr}.
258
Bram Moolenaarf65e5662012-07-10 15:18:22 +0200259:sign unplace * buffer={nr}
260 Remove all placed signs in buffer {nr}.
Bram Moolenaar071d4272004-06-13 20:20:40 +0000261
Bram Moolenaar162b7142018-12-21 15:17:36 +0100262:sign unplace * group={group} buffer={nr}
263 Remove all placed signs in group {group} from buffer {nr}.
264
265:sign unplace * group=* buffer={nr}
266 Remove all placed signs in all the groups from buffer {nr}.
267
Bram Moolenaar071d4272004-06-13 20:20:40 +0000268:sign unplace {id}
269 Remove the previously placed sign {id} from all files it
270 appears in.
271
Bram Moolenaar162b7142018-12-21 15:17:36 +0100272:sign unplace {id} group={group}
273 Remove the previously placed sign {id} in group {group} from
274 all files it appears in.
275
276:sign unplace {id} group=*
277 Remove the previously placed sign {id} in all the groups from
278 all the files it appears in.
279
Bram Moolenaar071d4272004-06-13 20:20:40 +0000280:sign unplace *
Bram Moolenaar6b7b7192019-01-11 13:42:41 +0100281 Remove all placed signs in the global group from all the files.
Bram Moolenaar7d83bf42018-12-29 18:53:55 +0100282
283:sign unplace * group={group}
Bram Moolenaar6b7b7192019-01-11 13:42:41 +0100284 Remove all placed signs in group {group} from all the files.
Bram Moolenaar162b7142018-12-21 15:17:36 +0100285
286:sign unplace * group=*
Bram Moolenaar6b7b7192019-01-11 13:42:41 +0100287 Remove all placed signs in all the groups from all the files.
Bram Moolenaar071d4272004-06-13 20:20:40 +0000288
289:sign unplace
Bram Moolenaar7d83bf42018-12-29 18:53:55 +0100290 Remove a placed sign at the cursor position. If multiple signs
291 are placed in the line, then only one is removed.
292
293:sign unplace group={group}
294 Remove a placed sign in group {group} at the cursor
295 position.
296
297:sign unplace group=*
298 Remove a placed sign in any group at the cursor position.
Bram Moolenaar071d4272004-06-13 20:20:40 +0000299
300
Bram Moolenaar36782082013-11-28 13:53:34 +0100301LISTING PLACED SIGNS *:sign-place-list*
Bram Moolenaar071d4272004-06-13 20:20:40 +0000302
Bram Moolenaar162b7142018-12-21 15:17:36 +0100303See |sign_getplaced()| for the equivalent Vim script function.
304
Bram Moolenaar071d4272004-06-13 20:20:40 +0000305:sign place file={fname}
306 List signs placed in file {fname}.
307 See remark above about {fname} |:sign-fname|.
308
Bram Moolenaar162b7142018-12-21 15:17:36 +0100309:sign place group={group} file={fname}
310 List signs in group {group} placed in file {fname}.
311
Bram Moolenaar7d83bf42018-12-29 18:53:55 +0100312:sign place group=* file={fname}
313 List signs in all the groups placed in file {fname}.
314
Bram Moolenaar071d4272004-06-13 20:20:40 +0000315:sign place buffer={nr}
316 List signs placed in buffer {nr}.
317
Bram Moolenaar162b7142018-12-21 15:17:36 +0100318:sign place group={group} buffer={nr}
319 List signs in group {group} placed in buffer {nr}.
320
Bram Moolenaar7d83bf42018-12-29 18:53:55 +0100321:sign place group=* buffer={nr}
322 List signs in all the groups placed in buffer {nr}.
Bram Moolenaar071d4272004-06-13 20:20:40 +0000323
Bram Moolenaar7d83bf42018-12-29 18:53:55 +0100324:sign place List placed signs in the global group in all files.
Bram Moolenaarc8c88492018-12-27 23:59:26 +0100325
Bram Moolenaar162b7142018-12-21 15:17:36 +0100326:sign place group={group}
Bram Moolenaarc8c88492018-12-27 23:59:26 +0100327 List placed signs with sign group {group} in all files.
Bram Moolenaar162b7142018-12-21 15:17:36 +0100328
Bram Moolenaar7d83bf42018-12-29 18:53:55 +0100329:sign place group=*
330 List placed signs in all sign groups in all files.
331
Bram Moolenaar071d4272004-06-13 20:20:40 +0000332
333JUMPING TO A SIGN *:sign-jump* *E157*
334
Bram Moolenaar6b7b7192019-01-11 13:42:41 +0100335See |sign_jump()| for the equivalent Vim script function.
336
Bram Moolenaar071d4272004-06-13 20:20:40 +0000337:sign jump {id} file={fname}
338 Open the file {fname} or jump to the window that contains
339 {fname} and position the cursor at sign {id}.
340 See remark above about {fname} |:sign-fname|.
341 If the file isn't displayed in window and the current file can
342 not be |abandon|ed this fails.
343
Bram Moolenaar7d83bf42018-12-29 18:53:55 +0100344:sign jump {id} group={group} file={fname}
345 Same but jump to the sign in group {group}
346
Bram Moolenaarb328cca2019-01-06 16:24:01 +0100347:sign jump {id} [buffer={nr}] *E934*
Bram Moolenaar7571d552016-08-18 22:54:46 +0200348 Same, but use buffer {nr}. This fails if buffer {nr} does not
Bram Moolenaarb328cca2019-01-06 16:24:01 +0100349 have a name. If the buffer argument is not given, use the
350 current buffer.
Bram Moolenaar7571d552016-08-18 22:54:46 +0200351
Bram Moolenaarb328cca2019-01-06 16:24:01 +0100352:sign jump {id} group={group} [buffer={nr}]
Bram Moolenaar7d83bf42018-12-29 18:53:55 +0100353 Same but jump to the sign in group {group}
354
Bram Moolenaar071d4272004-06-13 20:20:40 +0000355
Bram Moolenaared997ad2019-07-21 16:42:00 +0200356==============================================================================
3573. Functions *sign-functions-details*
358
359sign_define({name} [, {dict}]) *sign_define()*
360sign_define({list})
361 Define a new sign named {name} or modify the attributes of an
362 existing sign. This is similar to the |:sign-define| command.
363
364 Prefix {name} with a unique text to avoid name collisions.
365 There is no {group} like with placing signs.
366
367 The {name} can be a String or a Number. The optional {dict}
368 argument specifies the sign attributes. The following values
369 are supported:
370 icon full path to the bitmap file for the sign.
371 linehl highlight group used for the whole line the
372 sign is placed in.
373 text text that is displayed when there is no icon
374 or the GUI is not being used.
375 texthl highlight group used for the text item
376
377 If the sign named {name} already exists, then the attributes
378 of the sign are updated.
379
380 The one argument {list} can be used to define a list of signs.
381 Each list item is a dictionary with the above items in {dict}
Bram Moolenaar0c0734d2019-11-26 21:44:46 +0100382 and a "name" item for the sign name.
Bram Moolenaared997ad2019-07-21 16:42:00 +0200383
384 Returns 0 on success and -1 on failure. When the one argument
385 {list} is used, then returns a List of values one for each
386 defined sign.
387
388 Examples: >
389 call sign_define("mySign", {
390 \ "text" : "=>",
391 \ "texthl" : "Error",
392 \ "linehl" : "Search"})
393 call sign_define([
394 \ {'name' : 'sign1',
395 \ 'text' : '=>'},
396 \ {'name' : 'sign2',
397 \ 'text' : '!!'}
398 \ ])
399<
Bram Moolenaar93476fd2019-09-06 22:00:54 +0200400 Can also be used as a |method|: >
401 GetSignList()->sign_define()
402
Bram Moolenaared997ad2019-07-21 16:42:00 +0200403sign_getdefined([{name}]) *sign_getdefined()*
404 Get a list of defined signs and their attributes.
405 This is similar to the |:sign-list| command.
406
407 If the {name} is not supplied, then a list of all the defined
408 signs is returned. Otherwise the attribute of the specified
409 sign is returned.
410
411 Each list item in the returned value is a dictionary with the
412 following entries:
413 icon full path to the bitmap file of the sign
414 linehl highlight group used for the whole line the
415 sign is placed in.
416 name name of the sign
417 text text that is displayed when there is no icon
418 or the GUI is not being used.
419 texthl highlight group used for the text item
420
421 Returns an empty List if there are no signs and when {name} is
422 not found.
423
424 Examples: >
425 " Get a list of all the defined signs
426 echo sign_getdefined()
427
428 " Get the attribute of the sign named mySign
429 echo sign_getdefined("mySign")
430<
Bram Moolenaar93476fd2019-09-06 22:00:54 +0200431 Can also be used as a |method|: >
432 GetSignList()->sign_getdefined()
433
Bram Moolenaared997ad2019-07-21 16:42:00 +0200434sign_getplaced([{expr} [, {dict}]]) *sign_getplaced()*
435 Return a list of signs placed in a buffer or all the buffers.
436 This is similar to the |:sign-place-list| command.
437
438 If the optional buffer name {expr} is specified, then only the
439 list of signs placed in that buffer is returned. For the use
440 of {expr}, see |bufname()|. The optional {dict} can contain
441 the following entries:
442 group select only signs in this group
443 id select sign with this identifier
444 lnum select signs placed in this line. For the use
445 of {lnum}, see |line()|.
446 If {group} is '*', then signs in all the groups including the
447 global group are returned. If {group} is not supplied or is an
448 empty string, then only signs in the global group are
449 returned. If no arguments are supplied, then signs in the
450 global group placed in all the buffers are returned.
451 See |sign-group|.
452
453 Each list item in the returned value is a dictionary with the
454 following entries:
455 bufnr number of the buffer with the sign
456 signs list of signs placed in {bufnr}. Each list
457 item is a dictionary with the below listed
458 entries
459
460 The dictionary for each sign contains the following entries:
461 group sign group. Set to '' for the global group.
462 id identifier of the sign
463 lnum line number where the sign is placed
464 name name of the defined sign
465 priority sign priority
466
467 The returned signs in a buffer are ordered by their line
468 number and priority.
469
470 Returns an empty list on failure or if there are no placed
471 signs.
472
473 Examples: >
474 " Get a List of signs placed in eval.c in the
475 " global group
476 echo sign_getplaced("eval.c")
477
478 " Get a List of signs in group 'g1' placed in eval.c
479 echo sign_getplaced("eval.c", {'group' : 'g1'})
480
481 " Get a List of signs placed at line 10 in eval.c
482 echo sign_getplaced("eval.c", {'lnum' : 10})
483
484 " Get sign with identifier 10 placed in a.py
485 echo sign_getplaced("a.py", {'id' : 10})
486
487 " Get sign with id 20 in group 'g1' placed in a.py
488 echo sign_getplaced("a.py", {'group' : 'g1',
489 \ 'id' : 20})
490
491 " Get a List of all the placed signs
492 echo sign_getplaced()
493<
Bram Moolenaar93476fd2019-09-06 22:00:54 +0200494 Can also be used as a |method|: >
495 GetBufname()->sign_getplaced()
496<
Bram Moolenaared997ad2019-07-21 16:42:00 +0200497 *sign_jump()*
498sign_jump({id}, {group}, {expr})
499 Open the buffer {expr} or jump to the window that contains
500 {expr} and position the cursor at sign {id} in group {group}.
501 This is similar to the |:sign-jump| command.
502
503 For the use of {expr}, see |bufname()|.
504
505 Returns the line number of the sign. Returns -1 if the
506 arguments are invalid.
507
508 Example: >
509 " Jump to sign 10 in the current buffer
510 call sign_jump(10, '', '')
511<
Bram Moolenaar93476fd2019-09-06 22:00:54 +0200512 Can also be used as a |method|: >
513 GetSignid()->sign_jump()
514<
Bram Moolenaared997ad2019-07-21 16:42:00 +0200515 *sign_place()*
516sign_place({id}, {group}, {name}, {expr} [, {dict}])
517 Place the sign defined as {name} at line {lnum} in file or
518 buffer {expr} and assign {id} and {group} to sign. This is
519 similar to the |:sign-place| command.
520
521 If the sign identifier {id} is zero, then a new identifier is
522 allocated. Otherwise the specified number is used. {group} is
523 the sign group name. To use the global sign group, use an
524 empty string. {group} functions as a namespace for {id}, thus
525 two groups can use the same IDs. Refer to |sign-identifier|
526 and |sign-group| for more information.
527
528 {name} refers to a defined sign.
529 {expr} refers to a buffer name or number. For the accepted
530 values, see |bufname()|.
531
532 The optional {dict} argument supports the following entries:
533 lnum line number in the file or buffer
534 {expr} where the sign is to be placed.
535 For the accepted values, see |line()|.
536 priority priority of the sign. See
537 |sign-priority| for more information.
538
539 If the optional {dict} is not specified, then it modifies the
540 placed sign {id} in group {group} to use the defined sign
541 {name}.
542
543 Returns the sign identifier on success and -1 on failure.
544
545 Examples: >
546 " Place a sign named sign1 with id 5 at line 20 in
547 " buffer json.c
548 call sign_place(5, '', 'sign1', 'json.c',
549 \ {'lnum' : 20})
550
551 " Updates sign 5 in buffer json.c to use sign2
552 call sign_place(5, '', 'sign2', 'json.c')
553
554 " Place a sign named sign3 at line 30 in
555 " buffer json.c with a new identifier
556 let id = sign_place(0, '', 'sign3', 'json.c',
557 \ {'lnum' : 30})
558
559 " Place a sign named sign4 with id 10 in group 'g3'
560 " at line 40 in buffer json.c with priority 90
561 call sign_place(10, 'g3', 'sign4', 'json.c',
562 \ {'lnum' : 40, 'priority' : 90})
563<
Bram Moolenaar93476fd2019-09-06 22:00:54 +0200564 Can also be used as a |method|: >
565 GetSignid()->sign_place(group, name, expr)
566<
Bram Moolenaared997ad2019-07-21 16:42:00 +0200567 *sign_placelist()*
568sign_placelist({list})
569 Place one or more signs. This is similar to the
570 |sign_place()| function. The {list} argument specifies the
571 List of signs to place. Each list item is a dict with the
572 following sign attributes:
573 buffer buffer name or number. For the accepted
574 values, see |bufname()|.
575 group sign group. {group} functions as a namespace
576 for {id}, thus two groups can use the same
577 IDs. If not specified or set to an empty
578 string, then the global group is used. See
579 |sign-group| for more information.
580 id sign identifier. If not specified or zero,
581 then a new unique identifier is allocated.
582 Otherwise the specified number is used. See
583 |sign-identifier| for more information.
584 lnum line number in the buffer {expr} where the
585 sign is to be placed. For the accepted values,
586 see |line()|.
587 name name of the sign to place. See |sign_define()|
588 for more information.
589 priority priority of the sign. When multiple signs are
590 placed on a line, the sign with the highest
591 priority is used. If not specified, the
592 default value of 10 is used. See
593 |sign-priority| for more information.
594
595 If {id} refers to an existing sign, then the existing sign is
596 modified to use the specified {name} and/or {priority}.
597
598 Returns a List of sign identifiers. If failed to place a
599 sign, the corresponding list item is set to -1.
600
601 Examples: >
602 " Place sign s1 with id 5 at line 20 and id 10 at line
603 " 30 in buffer a.c
604 let [n1, n2] = sign_placelist([
605 \ {'id' : 5,
606 \ 'name' : 's1',
607 \ 'buffer' : 'a.c',
608 \ 'lnum' : 20},
609 \ {'id' : 10,
610 \ 'name' : 's1',
611 \ 'buffer' : 'a.c',
612 \ 'lnum' : 30}
613 \ ])
614
615 " Place sign s1 in buffer a.c at line 40 and 50
616 " with auto-generated identifiers
617 let [n1, n2] = sign_placelist([
618 \ {'name' : 's1',
619 \ 'buffer' : 'a.c',
620 \ 'lnum' : 40},
621 \ {'name' : 's1',
622 \ 'buffer' : 'a.c',
623 \ 'lnum' : 50}
624 \ ])
625<
Bram Moolenaar93476fd2019-09-06 22:00:54 +0200626 Can also be used as a |method|: >
627 GetSignlist()->sign_placelist()
Bram Moolenaared997ad2019-07-21 16:42:00 +0200628
629sign_undefine([{name}]) *sign_undefine()*
630sign_undefine({list})
631 Deletes a previously defined sign {name}. This is similar to
632 the |:sign-undefine| command. If {name} is not supplied, then
633 deletes all the defined signs.
634
635 The one argument {list} can be used to undefine a list of
636 signs. Each list item is the name of a sign.
637
638 Returns 0 on success and -1 on failure. For the one argument
639 {list} call, returns a list of values one for each undefined
640 sign.
641
642 Examples: >
643 " Delete a sign named mySign
644 call sign_undefine("mySign")
645
646 " Delete signs 'sign1' and 'sign2'
647 call sign_undefine(["sign1", "sign2"])
648
649 " Delete all the signs
650 call sign_undefine()
651<
Bram Moolenaar93476fd2019-09-06 22:00:54 +0200652 Can also be used as a |method|: >
653 GetSignlist()->sign_undefine()
Bram Moolenaared997ad2019-07-21 16:42:00 +0200654
655sign_unplace({group} [, {dict}]) *sign_unplace()*
656 Remove a previously placed sign in one or more buffers. This
657 is similar to the |:sign-unplace| command.
658
659 {group} is the sign group name. To use the global sign group,
660 use an empty string. If {group} is set to '*', then all the
661 groups including the global group are used.
662 The signs in {group} are selected based on the entries in
663 {dict}. The following optional entries in {dict} are
664 supported:
665 buffer buffer name or number. See |bufname()|.
666 id sign identifier
667 If {dict} is not supplied, then all the signs in {group} are
668 removed.
669
670 Returns 0 on success and -1 on failure.
671
672 Examples: >
673 " Remove sign 10 from buffer a.vim
674 call sign_unplace('', {'buffer' : "a.vim", 'id' : 10})
675
676 " Remove sign 20 in group 'g1' from buffer 3
677 call sign_unplace('g1', {'buffer' : 3, 'id' : 20})
678
679 " Remove all the signs in group 'g2' from buffer 10
680 call sign_unplace('g2', {'buffer' : 10})
681
682 " Remove sign 30 in group 'g3' from all the buffers
683 call sign_unplace('g3', {'id' : 30})
684
685 " Remove all the signs placed in buffer 5
686 call sign_unplace('*', {'buffer' : 5})
687
688 " Remove the signs in group 'g4' from all the buffers
689 call sign_unplace('g4')
690
691 " Remove sign 40 from all the buffers
692 call sign_unplace('*', {'id' : 40})
693
694 " Remove all the placed signs from all the buffers
695 call sign_unplace('*')
Bram Moolenaar93476fd2019-09-06 22:00:54 +0200696
697< Can also be used as a |method|: >
698 GetSigngroup()->sign_unplace()
Bram Moolenaared997ad2019-07-21 16:42:00 +0200699<
700sign_unplacelist({list}) *sign_unplacelist()*
701 Remove previously placed signs from one or more buffers. This
702 is similar to the |sign_unplace()| function.
703
704 The {list} argument specifies the List of signs to remove.
705 Each list item is a dict with the following sign attributes:
706 buffer buffer name or number. For the accepted
707 values, see |bufname()|. If not specified,
708 then the specified sign is removed from all
709 the buffers.
710 group sign group name. If not specified or set to an
711 empty string, then the global sign group is
712 used. If set to '*', then all the groups
713 including the global group are used.
714 id sign identifier. If not specified, then all
715 the signs in the specified group are removed.
716
717 Returns a List where an entry is set to 0 if the corresponding
718 sign was successfully removed or -1 on failure.
719
720 Example: >
721 " Remove sign with id 10 from buffer a.vim and sign
722 " with id 20 from buffer b.vim
723 call sign_unplacelist([
724 \ {'id' : 10, 'buffer' : "a.vim"},
725 \ {'id' : 20, 'buffer' : 'b.vim'},
726 \ ])
727<
Bram Moolenaar93476fd2019-09-06 22:00:54 +0200728 Can also be used as a |method|: >
729 GetSignlist()->sign_unplacelist()
730<
Bram Moolenaared997ad2019-07-21 16:42:00 +0200731
Bram Moolenaar91f84f62018-07-29 15:07:52 +0200732 vim:tw=78:ts=8:noet:ft=help:norl: