zeertzjq | fc3f5db | 2024-07-07 20:33:46 +0200 | [diff] [blame] | 1 | *sign.txt* For Vim version 9.1. Last change: 2024 Jul 07 |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 2 | |
| 3 | |
| 4 | VIM REFERENCE MANUAL by Gordon Prieur |
| 5 | and Bram Moolenaar |
| 6 | |
| 7 | |
| 8 | Sign Support Features *sign-support* |
| 9 | |
| 10 | 1. Introduction |sign-intro| |
| 11 | 2. Commands |sign-commands| |
Bram Moolenaar | ed997ad | 2019-07-21 16:42:00 +0200 | [diff] [blame] | 12 | 3. Functions |sign-functions-details| |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 13 | |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 14 | {only available when compiled with the |+signs| feature} |
| 15 | |
| 16 | ============================================================================== |
| 17 | 1. Introduction *sign-intro* *signs* |
| 18 | |
| 19 | When a debugger or other IDE tool is driving an editor it needs to be able |
| 20 | to give specific highlights which quickly tell the user useful information |
Bram Moolenaar | 402d2fe | 2005-04-15 21:00:38 +0000 | [diff] [blame] | 21 | about the file. One example of this would be a debugger which had an icon |
| 22 | in the left-hand column denoting a breakpoint. Another example might be an |
| 23 | arrow representing the Program Counter (PC). The sign features allow both |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 24 | placement of a sign, or icon, in the left-hand side of the window and |
Bram Moolenaar | 402d2fe | 2005-04-15 21:00:38 +0000 | [diff] [blame] | 25 | definition of a highlight which will be applied to that line. Displaying the |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 26 | sign as an image is most likely only feasible in gvim (although Sun |
Bram Moolenaar | 402d2fe | 2005-04-15 21:00:38 +0000 | [diff] [blame] | 27 | Microsystem's dtterm does support this it's the only terminal emulator I know |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 28 | of which does). A text sign and the highlight should be feasible in any color |
| 29 | terminal emulator. |
| 30 | |
Bram Moolenaar | 402d2fe | 2005-04-15 21:00:38 +0000 | [diff] [blame] | 31 | Signs and highlights are not useful just for debuggers. Sun's Visual |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 32 | WorkShop uses signs and highlights to mark build errors and SourceBrowser |
Bram Moolenaar | 402d2fe | 2005-04-15 21:00:38 +0000 | [diff] [blame] | 33 | hits. Additionally, the debugger supports 8 to 10 different signs and |
Bram Moolenaar | d09091d | 2019-01-17 16:07:22 +0100 | [diff] [blame] | 34 | highlight colors, see |NetBeans|. |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 35 | |
| 36 | There are two steps in using signs: |
| 37 | |
| 38 | 1. 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 | |
| 42 | 2. 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 Moolenaar | d09091d | 2019-01-17 16:07:22 +0100 | [diff] [blame] | 46 | *sign-column* |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 47 | When signs are defined for a file, Vim will automatically add a column of two |
| 48 | characters to display them in. When the last sign is unplaced the column |
Bram Moolenaar | 0952131 | 2016-08-12 22:54:35 +0200 | [diff] [blame] | 49 | disappears again. This behavior can be changed with the 'signcolumn' option. |
| 50 | |
Bram Moolenaar | 574ee7b | 2019-11-13 23:04:29 +0100 | [diff] [blame] | 51 | The color of the column is set with the SignColumn highlight group |
| 52 | |hl-SignColumn|. Example to set the color: > |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 53 | |
| 54 | :highlight SignColumn guibg=darkgrey |
Bram Moolenaar | 162b714 | 2018-12-21 15:17:36 +0100 | [diff] [blame] | 55 | < |
Bram Moolenaar | e413ea0 | 2021-11-24 16:20:13 +0000 | [diff] [blame] | 56 | If 'cursorline' is enabled, then the CursorLineSign highlight group is used |
| 57 | |hl-CursorLineSign|. |
Bram Moolenaar | b328cca | 2019-01-06 16:24:01 +0100 | [diff] [blame] | 58 | *sign-identifier* |
| 59 | Each placed sign is identified by a number called the sign identifier. This |
| 60 | identifier is used to jump to the sign or to remove the sign. The identifier |
Bram Moolenaar | d09091d | 2019-01-17 16:07:22 +0100 | [diff] [blame] | 61 | is assigned when placing the sign using the |:sign-place| command or the |
Bram Moolenaar | b328cca | 2019-01-06 16:24:01 +0100 | [diff] [blame] | 62 | |sign_place()| function. Each sign identifier should be a unique number. If |
| 63 | multiple placed signs use the same identifier, then jumping to or removing a |
| 64 | sign becomes unpredictable. To avoid overlapping identifiers, sign groups can |
| 65 | be used. The |sign_place()| function can be called with a zero sign identifier |
| 66 | to allocate the next available identifier. |
| 67 | |
Bram Moolenaar | 162b714 | 2018-12-21 15:17:36 +0100 | [diff] [blame] | 68 | *sign-group* |
Bram Moolenaar | b328cca | 2019-01-06 16:24:01 +0100 | [diff] [blame] | 69 | Each placed sign can be assigned to either the global group or a named group. |
| 70 | When placing a sign, if a group name is not supplied, or an empty string is |
| 71 | used, then the sign is placed in the global group. Otherwise the sign is |
| 72 | placed in the named group. The sign identifier is unique within a group. The |
| 73 | sign group allows Vim plugins to use unique signs without interfering with |
| 74 | other plugins using signs. |
Bram Moolenaar | 162b714 | 2018-12-21 15:17:36 +0100 | [diff] [blame] | 75 | |
Bram Moolenaar | 7257073 | 2019-11-30 14:21:53 +0100 | [diff] [blame] | 76 | To place a sign in a popup window the group name must start with "PopUp". |
| 77 | Other signs will not show in a popup window. The group name "PopUpMenu" is |
| 78 | used by popup windows where 'cursorline' is set. |
| 79 | |
Bram Moolenaar | 162b714 | 2018-12-21 15:17:36 +0100 | [diff] [blame] | 80 | *sign-priority* |
| 81 | Each placed sign is assigned a priority value. When multiple signs are placed |
| 82 | on the same line, the attributes of the sign with the highest priority is used |
LemonBoy | b975ddf | 2024-07-06 18:04:09 +0200 | [diff] [blame] | 83 | independently of the sign group. The default priority for a sign is 10, this |
| 84 | value can be changed for different signs by specifying a different value at |
| 85 | definition time. The priority is assigned at the time of placing a sign. |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 86 | |
Bram Moolenaar | 3132cdd | 2020-11-05 20:41:49 +0100 | [diff] [blame] | 87 | When two signs with the same priority are present, and one has an icon or text |
| 88 | in the signcolumn while the other has line highlighting, then both are |
| 89 | displayed. |
| 90 | |
Bram Moolenaar | d09091d | 2019-01-17 16:07:22 +0100 | [diff] [blame] | 91 | When the line on which the sign is placed is deleted, the sign is moved to the |
| 92 | next line (or the last line of the buffer, if there is no next line). When |
| 93 | the delete is undone the sign does not move back. |
| 94 | |
Bram Moolenaar | 39f7aa3 | 2020-08-31 22:00:05 +0200 | [diff] [blame] | 95 | When a sign with line highlighting and 'cursorline' highlighting are both |
| 96 | present, if the priority is 100 or more then the sign highlighting takes |
| 97 | precedence, otherwise the 'cursorline' highlighting. |
| 98 | |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 99 | ============================================================================== |
| 100 | 2. Commands *sign-commands* *:sig* *:sign* |
| 101 | |
Bram Moolenaar | 00a927d | 2010-05-14 23:24:24 +0200 | [diff] [blame] | 102 | Here is an example that places a sign "piet", displayed with the text ">>", in |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 103 | line 23 of the current file: > |
| 104 | :sign define piet text=>> texthl=Search |
Bram Moolenaar | c51cf03 | 2022-02-26 12:25:45 +0000 | [diff] [blame] | 105 | :exe ":sign place 2 line=23 name=piet file=" .. expand("%:p") |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 106 | |
| 107 | And here is the command to delete it again: > |
| 108 | :sign unplace 2 |
| 109 | |
| 110 | Note that the ":sign" command cannot be followed by another command or a |
| 111 | comment. If you do need that, use the |:execute| command. |
| 112 | |
| 113 | |
| 114 | DEFINING A SIGN. *:sign-define* *E255* *E160* *E612* |
| 115 | |
Bram Moolenaar | 162b714 | 2018-12-21 15:17:36 +0100 | [diff] [blame] | 116 | See |sign_define()| for the equivalent Vim script function. |
| 117 | |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 118 | :sign define {name} {argument}... |
| 119 | Define a new sign or set attributes for an existing sign. |
| 120 | The {name} can either be a number (all digits) or a name |
Bram Moolenaar | 4c05fa0 | 2019-01-01 15:32:17 +0100 | [diff] [blame] | 121 | starting with a non-digit. Leading zeros are ignored, thus |
Bram Moolenaar | 483c5d8 | 2010-10-20 18:45:33 +0200 | [diff] [blame] | 122 | "0012", "012" and "12" are considered the same name. |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 123 | About 120 different signs can be defined. |
| 124 | |
| 125 | Accepted arguments: |
| 126 | |
Bram Moolenaar | 6ee8d89 | 2012-01-10 14:55:01 +0100 | [diff] [blame] | 127 | icon={bitmap} |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 128 | Define the file name where the bitmap can be found. Should be |
| 129 | a full path. The bitmap should fit in the place of two |
| 130 | characters. This is not checked. If the bitmap is too big it |
| 131 | will cause redraw problems. Only GTK 2 can scale the bitmap |
| 132 | to fit the space available. |
| 133 | toolkit supports ~ |
| 134 | GTK 1 pixmap (.xpm) |
| 135 | GTK 2 many |
| 136 | Motif pixmap (.xpm) |
Bram Moolenaar | 6ee8d89 | 2012-01-10 14:55:01 +0100 | [diff] [blame] | 137 | Win32 .bmp, .ico, .cur |
| 138 | pixmap (.xpm) |+xpm_w32| |
LemonBoy | b975ddf | 2024-07-06 18:04:09 +0200 | [diff] [blame] | 139 | priority={prio} |
| 140 | Default priority for the sign, see |sign-priority|. |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 141 | |
| 142 | linehl={group} |
| 143 | Highlighting group used for the whole line the sign is placed |
| 144 | in. Most useful is defining a background color. |
| 145 | |
James McCoy | a80aad7 | 2021-12-22 19:45:28 +0000 | [diff] [blame] | 146 | numhl={group} |
| 147 | Highlighting group used for the line number on the line where |
| 148 | the sign is placed. Overrides |hl-LineNr|, |hl-LineNrAbove|, |
| 149 | |hl-LineNrBelow|, and |hl-CursorLineNr|. |
| 150 | |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 151 | text={text} *E239* |
| 152 | Define the text that is displayed when there is no icon or the |
| 153 | GUI is not being used. Only printable characters are allowed |
| 154 | and they must occupy one or two display cells. |
| 155 | |
| 156 | texthl={group} |
| 157 | Highlighting group used for the text item. |
| 158 | |
Bram Moolenaar | 6304be6 | 2021-11-27 10:57:26 +0000 | [diff] [blame] | 159 | culhl={group} |
| 160 | Highlighting group used for the text item when the cursor is |
| 161 | on the same line as the sign and 'cursorline' is enabled. |
| 162 | |
Bram Moolenaar | c8cdf0f | 2021-03-13 13:28:13 +0100 | [diff] [blame] | 163 | Example: > |
| 164 | :sign define MySign text=>> texthl=Search linehl=DiffText |
| 165 | < |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 166 | |
| 167 | DELETING A SIGN *:sign-undefine* *E155* |
| 168 | |
Bram Moolenaar | 162b714 | 2018-12-21 15:17:36 +0100 | [diff] [blame] | 169 | See |sign_undefine()| for the equivalent Vim script function. |
| 170 | |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 171 | :sign undefine {name} |
| 172 | Deletes a previously defined sign. If signs with this {name} |
| 173 | are still placed this will cause trouble. |
| 174 | |
Bram Moolenaar | c8cdf0f | 2021-03-13 13:28:13 +0100 | [diff] [blame] | 175 | Example: > |
| 176 | :sign undefine MySign |
| 177 | < |
Bram Moolenaar | 162b714 | 2018-12-21 15:17:36 +0100 | [diff] [blame] | 178 | |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 179 | LISTING SIGNS *:sign-list* *E156* |
| 180 | |
Bram Moolenaar | 162b714 | 2018-12-21 15:17:36 +0100 | [diff] [blame] | 181 | See |sign_getdefined()| for the equivalent Vim script function. |
| 182 | |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 183 | :sign list Lists all defined signs and their attributes. |
| 184 | |
| 185 | :sign list {name} |
| 186 | Lists one defined sign and its attributes. |
| 187 | |
| 188 | |
| 189 | PLACING SIGNS *:sign-place* *E158* |
| 190 | |
Bram Moolenaar | 162b714 | 2018-12-21 15:17:36 +0100 | [diff] [blame] | 191 | See |sign_place()| for the equivalent Vim script function. |
| 192 | |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 193 | :sign place {id} line={lnum} name={name} file={fname} |
| 194 | Place sign defined as {name} at line {lnum} in file {fname}. |
| 195 | *:sign-fname* |
| 196 | The file {fname} must already be loaded in a buffer. The |
| 197 | exact file name must be used, wildcards, $ENV and ~ are not |
| 198 | expanded, white space must not be escaped. Trailing white |
| 199 | space is ignored. |
| 200 | |
| 201 | The sign is remembered under {id}, this can be used for |
| 202 | further manipulation. {id} must be a number. |
| 203 | It's up to the user to make sure the {id} is used only once in |
| 204 | each file (if it's used several times unplacing will also have |
| 205 | to be done several times and making changes may not work as |
| 206 | expected). |
| 207 | |
Bram Moolenaar | 162b714 | 2018-12-21 15:17:36 +0100 | [diff] [blame] | 208 | The following optional sign attributes can be specified before |
| 209 | "file=": |
| 210 | group={group} Place sign in sign group {group} |
| 211 | priority={prio} Assign priority {prio} to sign |
| 212 | |
| 213 | By default, the sign is placed in the global sign group. |
| 214 | |
LemonBoy | b975ddf | 2024-07-06 18:04:09 +0200 | [diff] [blame] | 215 | By default, the sign is assigned a default priority of 10, |
| 216 | unless specified otherwise by the sign definition. To assign a |
| 217 | different priority value, use "priority={prio}" to specify a |
| 218 | value. The priority is used to determine the sign that is |
| 219 | displayed when multiple signs are placed on the same line. |
Bram Moolenaar | 162b714 | 2018-12-21 15:17:36 +0100 | [diff] [blame] | 220 | |
| 221 | Examples: > |
| 222 | :sign place 5 line=3 name=sign1 file=a.py |
| 223 | :sign place 6 group=g2 line=2 name=sign2 file=x.py |
| 224 | :sign place 9 group=g2 priority=50 line=5 |
| 225 | \ name=sign1 file=a.py |
| 226 | < |
Bram Moolenaar | b328cca | 2019-01-06 16:24:01 +0100 | [diff] [blame] | 227 | :sign place {id} line={lnum} name={name} [buffer={nr}] |
| 228 | Same, but use buffer {nr}. If the buffer argument is not |
| 229 | given, place the sign in the current buffer. |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 230 | |
Bram Moolenaar | c8cdf0f | 2021-03-13 13:28:13 +0100 | [diff] [blame] | 231 | Example: > |
| 232 | :sign place 10 line=99 name=sign3 |
| 233 | :sign place 10 line=99 name=sign3 buffer=3 |
| 234 | < |
Bram Moolenaar | e968e36 | 2014-05-13 20:23:24 +0200 | [diff] [blame] | 235 | *E885* |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 236 | :sign place {id} name={name} file={fname} |
| 237 | Change the placed sign {id} in file {fname} to use the defined |
| 238 | sign {name}. See remark above about {fname} |:sign-fname|. |
| 239 | This can be used to change the displayed sign without moving |
| 240 | it (e.g., when the debugger has stopped at a breakpoint). |
| 241 | |
Bram Moolenaar | 162b714 | 2018-12-21 15:17:36 +0100 | [diff] [blame] | 242 | The optional "group={group}" attribute can be used before |
Bram Moolenaar | 58a7f87 | 2019-06-04 22:48:15 +0200 | [diff] [blame] | 243 | "file=" to select a sign in a particular group. The optional |
| 244 | "priority={prio}" attribute can be used to change the priority |
| 245 | of an existing sign. |
Bram Moolenaar | 162b714 | 2018-12-21 15:17:36 +0100 | [diff] [blame] | 246 | |
Bram Moolenaar | c8cdf0f | 2021-03-13 13:28:13 +0100 | [diff] [blame] | 247 | Example: > |
| 248 | :sign place 23 name=sign1 file=/path/to/edit.py |
| 249 | < |
Bram Moolenaar | b328cca | 2019-01-06 16:24:01 +0100 | [diff] [blame] | 250 | :sign place {id} name={name} [buffer={nr}] |
| 251 | Same, but use buffer {nr}. If the buffer argument is not |
| 252 | given, use the current buffer. |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 253 | |
Bram Moolenaar | c8cdf0f | 2021-03-13 13:28:13 +0100 | [diff] [blame] | 254 | Example: > |
| 255 | :sign place 23 name=sign1 |
| 256 | :sign place 23 name=sign1 buffer=7 |
| 257 | < |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 258 | |
| 259 | REMOVING SIGNS *:sign-unplace* *E159* |
| 260 | |
Bram Moolenaar | 162b714 | 2018-12-21 15:17:36 +0100 | [diff] [blame] | 261 | See |sign_unplace()| for the equivalent Vim script function. |
| 262 | |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 263 | :sign unplace {id} file={fname} |
| 264 | Remove the previously placed sign {id} from file {fname}. |
| 265 | See remark above about {fname} |:sign-fname|. |
| 266 | |
Bram Moolenaar | 162b714 | 2018-12-21 15:17:36 +0100 | [diff] [blame] | 267 | :sign unplace {id} group={group} file={fname} |
| 268 | Same but remove the sign {id} in sign group {group}. |
| 269 | |
| 270 | :sign unplace {id} group=* file={fname} |
| 271 | Same but remove the sign {id} from all the sign groups. |
| 272 | |
Bram Moolenaar | f65e566 | 2012-07-10 15:18:22 +0200 | [diff] [blame] | 273 | :sign unplace * file={fname} |
| 274 | Remove all placed signs in file {fname}. |
| 275 | |
Bram Moolenaar | 162b714 | 2018-12-21 15:17:36 +0100 | [diff] [blame] | 276 | :sign unplace * group={group} file={fname} |
| 277 | Remove all placed signs in group {group} from file {fname}. |
| 278 | |
| 279 | :sign unplace * group=* file={fname} |
| 280 | Remove all placed signs in all the groups from file {fname}. |
| 281 | |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 282 | :sign unplace {id} buffer={nr} |
Bram Moolenaar | f65e566 | 2012-07-10 15:18:22 +0200 | [diff] [blame] | 283 | Remove the previously placed sign {id} from buffer {nr}. |
| 284 | |
Bram Moolenaar | 162b714 | 2018-12-21 15:17:36 +0100 | [diff] [blame] | 285 | :sign unplace {id} group={group} buffer={nr} |
| 286 | Remove the previously placed sign {id} in group {group} from |
| 287 | buffer {nr}. |
| 288 | |
| 289 | :sign unplace {id} group=* buffer={nr} |
| 290 | Remove the previously placed sign {id} in all the groups from |
| 291 | buffer {nr}. |
| 292 | |
Bram Moolenaar | f65e566 | 2012-07-10 15:18:22 +0200 | [diff] [blame] | 293 | :sign unplace * buffer={nr} |
| 294 | Remove all placed signs in buffer {nr}. |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 295 | |
Bram Moolenaar | 162b714 | 2018-12-21 15:17:36 +0100 | [diff] [blame] | 296 | :sign unplace * group={group} buffer={nr} |
| 297 | Remove all placed signs in group {group} from buffer {nr}. |
| 298 | |
| 299 | :sign unplace * group=* buffer={nr} |
| 300 | Remove all placed signs in all the groups from buffer {nr}. |
| 301 | |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 302 | :sign unplace {id} |
| 303 | Remove the previously placed sign {id} from all files it |
| 304 | appears in. |
| 305 | |
Bram Moolenaar | 162b714 | 2018-12-21 15:17:36 +0100 | [diff] [blame] | 306 | :sign unplace {id} group={group} |
| 307 | Remove the previously placed sign {id} in group {group} from |
| 308 | all files it appears in. |
| 309 | |
| 310 | :sign unplace {id} group=* |
| 311 | Remove the previously placed sign {id} in all the groups from |
| 312 | all the files it appears in. |
| 313 | |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 314 | :sign unplace * |
Bram Moolenaar | 6b7b719 | 2019-01-11 13:42:41 +0100 | [diff] [blame] | 315 | Remove all placed signs in the global group from all the files. |
Bram Moolenaar | 7d83bf4 | 2018-12-29 18:53:55 +0100 | [diff] [blame] | 316 | |
| 317 | :sign unplace * group={group} |
Bram Moolenaar | 6b7b719 | 2019-01-11 13:42:41 +0100 | [diff] [blame] | 318 | Remove all placed signs in group {group} from all the files. |
Bram Moolenaar | 162b714 | 2018-12-21 15:17:36 +0100 | [diff] [blame] | 319 | |
| 320 | :sign unplace * group=* |
Bram Moolenaar | 6b7b719 | 2019-01-11 13:42:41 +0100 | [diff] [blame] | 321 | Remove all placed signs in all the groups from all the files. |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 322 | |
| 323 | :sign unplace |
Bram Moolenaar | 7d83bf4 | 2018-12-29 18:53:55 +0100 | [diff] [blame] | 324 | Remove a placed sign at the cursor position. If multiple signs |
| 325 | are placed in the line, then only one is removed. |
| 326 | |
| 327 | :sign unplace group={group} |
| 328 | Remove a placed sign in group {group} at the cursor |
| 329 | position. |
| 330 | |
| 331 | :sign unplace group=* |
| 332 | Remove a placed sign in any group at the cursor position. |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 333 | |
| 334 | |
Bram Moolenaar | 3678208 | 2013-11-28 13:53:34 +0100 | [diff] [blame] | 335 | LISTING PLACED SIGNS *:sign-place-list* |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 336 | |
Bram Moolenaar | 162b714 | 2018-12-21 15:17:36 +0100 | [diff] [blame] | 337 | See |sign_getplaced()| for the equivalent Vim script function. |
| 338 | |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 339 | :sign place file={fname} |
| 340 | List signs placed in file {fname}. |
| 341 | See remark above about {fname} |:sign-fname|. |
| 342 | |
Bram Moolenaar | 162b714 | 2018-12-21 15:17:36 +0100 | [diff] [blame] | 343 | :sign place group={group} file={fname} |
| 344 | List signs in group {group} placed in file {fname}. |
| 345 | |
Bram Moolenaar | 7d83bf4 | 2018-12-29 18:53:55 +0100 | [diff] [blame] | 346 | :sign place group=* file={fname} |
| 347 | List signs in all the groups placed in file {fname}. |
| 348 | |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 349 | :sign place buffer={nr} |
| 350 | List signs placed in buffer {nr}. |
| 351 | |
Bram Moolenaar | 162b714 | 2018-12-21 15:17:36 +0100 | [diff] [blame] | 352 | :sign place group={group} buffer={nr} |
| 353 | List signs in group {group} placed in buffer {nr}. |
| 354 | |
Bram Moolenaar | 7d83bf4 | 2018-12-29 18:53:55 +0100 | [diff] [blame] | 355 | :sign place group=* buffer={nr} |
| 356 | List signs in all the groups placed in buffer {nr}. |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 357 | |
Bram Moolenaar | 7d83bf4 | 2018-12-29 18:53:55 +0100 | [diff] [blame] | 358 | :sign place List placed signs in the global group in all files. |
Bram Moolenaar | c8c8849 | 2018-12-27 23:59:26 +0100 | [diff] [blame] | 359 | |
Bram Moolenaar | 162b714 | 2018-12-21 15:17:36 +0100 | [diff] [blame] | 360 | :sign place group={group} |
Bram Moolenaar | c8c8849 | 2018-12-27 23:59:26 +0100 | [diff] [blame] | 361 | List placed signs with sign group {group} in all files. |
Bram Moolenaar | 162b714 | 2018-12-21 15:17:36 +0100 | [diff] [blame] | 362 | |
Bram Moolenaar | 7d83bf4 | 2018-12-29 18:53:55 +0100 | [diff] [blame] | 363 | :sign place group=* |
| 364 | List placed signs in all sign groups in all files. |
| 365 | |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 366 | |
| 367 | JUMPING TO A SIGN *:sign-jump* *E157* |
| 368 | |
Bram Moolenaar | 6b7b719 | 2019-01-11 13:42:41 +0100 | [diff] [blame] | 369 | See |sign_jump()| for the equivalent Vim script function. |
| 370 | |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 371 | :sign jump {id} file={fname} |
| 372 | Open the file {fname} or jump to the window that contains |
| 373 | {fname} and position the cursor at sign {id}. |
| 374 | See remark above about {fname} |:sign-fname|. |
| 375 | If the file isn't displayed in window and the current file can |
| 376 | not be |abandon|ed this fails. |
| 377 | |
Bram Moolenaar | 7d83bf4 | 2018-12-29 18:53:55 +0100 | [diff] [blame] | 378 | :sign jump {id} group={group} file={fname} |
| 379 | Same but jump to the sign in group {group} |
| 380 | |
Bram Moolenaar | b328cca | 2019-01-06 16:24:01 +0100 | [diff] [blame] | 381 | :sign jump {id} [buffer={nr}] *E934* |
Bram Moolenaar | 7571d55 | 2016-08-18 22:54:46 +0200 | [diff] [blame] | 382 | Same, but use buffer {nr}. This fails if buffer {nr} does not |
Bram Moolenaar | b328cca | 2019-01-06 16:24:01 +0100 | [diff] [blame] | 383 | have a name. If the buffer argument is not given, use the |
| 384 | current buffer. |
Bram Moolenaar | 7571d55 | 2016-08-18 22:54:46 +0200 | [diff] [blame] | 385 | |
Bram Moolenaar | b328cca | 2019-01-06 16:24:01 +0100 | [diff] [blame] | 386 | :sign jump {id} group={group} [buffer={nr}] |
Bram Moolenaar | 7d83bf4 | 2018-12-29 18:53:55 +0100 | [diff] [blame] | 387 | Same but jump to the sign in group {group} |
| 388 | |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 389 | |
Bram Moolenaar | ed997ad | 2019-07-21 16:42:00 +0200 | [diff] [blame] | 390 | ============================================================================== |
| 391 | 3. Functions *sign-functions-details* |
| 392 | |
| 393 | sign_define({name} [, {dict}]) *sign_define()* |
| 394 | sign_define({list}) |
| 395 | Define a new sign named {name} or modify the attributes of an |
| 396 | existing sign. This is similar to the |:sign-define| command. |
| 397 | |
| 398 | Prefix {name} with a unique text to avoid name collisions. |
| 399 | There is no {group} like with placing signs. |
| 400 | |
| 401 | The {name} can be a String or a Number. The optional {dict} |
| 402 | argument specifies the sign attributes. The following values |
| 403 | are supported: |
| 404 | icon full path to the bitmap file for the sign. |
| 405 | linehl highlight group used for the whole line the |
| 406 | sign is placed in. |
zeertzjq | fc3f5db | 2024-07-07 20:33:46 +0200 | [diff] [blame] | 407 | priority default priority value of the sign |
James McCoy | a80aad7 | 2021-12-22 19:45:28 +0000 | [diff] [blame] | 408 | numhl highlight group used for the line number where |
| 409 | the sign is placed. |
Bram Moolenaar | ed997ad | 2019-07-21 16:42:00 +0200 | [diff] [blame] | 410 | text text that is displayed when there is no icon |
| 411 | or the GUI is not being used. |
| 412 | texthl highlight group used for the text item |
Bram Moolenaar | e413ea0 | 2021-11-24 16:20:13 +0000 | [diff] [blame] | 413 | culhl highlight group used for the text item when |
| 414 | the cursor is on the same line as the sign and |
| 415 | 'cursorline' is enabled. |
Bram Moolenaar | ed997ad | 2019-07-21 16:42:00 +0200 | [diff] [blame] | 416 | |
| 417 | If the sign named {name} already exists, then the attributes |
| 418 | of the sign are updated. |
| 419 | |
| 420 | The one argument {list} can be used to define a list of signs. |
| 421 | Each list item is a dictionary with the above items in {dict} |
Bram Moolenaar | 0c0734d | 2019-11-26 21:44:46 +0100 | [diff] [blame] | 422 | and a "name" item for the sign name. |
Bram Moolenaar | ed997ad | 2019-07-21 16:42:00 +0200 | [diff] [blame] | 423 | |
| 424 | Returns 0 on success and -1 on failure. When the one argument |
| 425 | {list} is used, then returns a List of values one for each |
| 426 | defined sign. |
| 427 | |
| 428 | Examples: > |
| 429 | call sign_define("mySign", { |
| 430 | \ "text" : "=>", |
| 431 | \ "texthl" : "Error", |
| 432 | \ "linehl" : "Search"}) |
| 433 | call sign_define([ |
| 434 | \ {'name' : 'sign1', |
| 435 | \ 'text' : '=>'}, |
| 436 | \ {'name' : 'sign2', |
| 437 | \ 'text' : '!!'} |
| 438 | \ ]) |
| 439 | < |
Bram Moolenaar | 93476fd | 2019-09-06 22:00:54 +0200 | [diff] [blame] | 440 | Can also be used as a |method|: > |
| 441 | GetSignList()->sign_define() |
Christian Brabandt | 5674c9a | 2024-06-09 00:13:43 +0200 | [diff] [blame] | 442 | < |
| 443 | Return type: |Number| |
| 444 | |
Bram Moolenaar | 93476fd | 2019-09-06 22:00:54 +0200 | [diff] [blame] | 445 | |
Bram Moolenaar | ed997ad | 2019-07-21 16:42:00 +0200 | [diff] [blame] | 446 | sign_getdefined([{name}]) *sign_getdefined()* |
| 447 | Get a list of defined signs and their attributes. |
| 448 | This is similar to the |:sign-list| command. |
| 449 | |
| 450 | If the {name} is not supplied, then a list of all the defined |
| 451 | signs is returned. Otherwise the attribute of the specified |
| 452 | sign is returned. |
| 453 | |
| 454 | Each list item in the returned value is a dictionary with the |
| 455 | following entries: |
| 456 | icon full path to the bitmap file of the sign |
| 457 | linehl highlight group used for the whole line the |
Bram Moolenaar | 4700398 | 2021-12-05 21:54:04 +0000 | [diff] [blame] | 458 | sign is placed in; not present if not set |
Bram Moolenaar | ed997ad | 2019-07-21 16:42:00 +0200 | [diff] [blame] | 459 | name name of the sign |
LemonBoy | b975ddf | 2024-07-06 18:04:09 +0200 | [diff] [blame] | 460 | priority default priority value of the sign |
James McCoy | a80aad7 | 2021-12-22 19:45:28 +0000 | [diff] [blame] | 461 | numhl highlight group used for the line number where |
| 462 | the sign is placed; not present if not set |
Bram Moolenaar | ed997ad | 2019-07-21 16:42:00 +0200 | [diff] [blame] | 463 | text text that is displayed when there is no icon |
| 464 | or the GUI is not being used. |
Bram Moolenaar | 4700398 | 2021-12-05 21:54:04 +0000 | [diff] [blame] | 465 | texthl highlight group used for the text item; not |
| 466 | present if not set |
Bram Moolenaar | e413ea0 | 2021-11-24 16:20:13 +0000 | [diff] [blame] | 467 | culhl highlight group used for the text item when |
| 468 | the cursor is on the same line as the sign and |
Bram Moolenaar | 4700398 | 2021-12-05 21:54:04 +0000 | [diff] [blame] | 469 | 'cursorline' is enabled; not present if not |
| 470 | set |
Bram Moolenaar | ed997ad | 2019-07-21 16:42:00 +0200 | [diff] [blame] | 471 | |
| 472 | Returns an empty List if there are no signs and when {name} is |
| 473 | not found. |
| 474 | |
| 475 | Examples: > |
| 476 | " Get a list of all the defined signs |
| 477 | echo sign_getdefined() |
| 478 | |
| 479 | " Get the attribute of the sign named mySign |
| 480 | echo sign_getdefined("mySign") |
| 481 | < |
Bram Moolenaar | 93476fd | 2019-09-06 22:00:54 +0200 | [diff] [blame] | 482 | Can also be used as a |method|: > |
| 483 | GetSignList()->sign_getdefined() |
Christian Brabandt | 5674c9a | 2024-06-09 00:13:43 +0200 | [diff] [blame] | 484 | < |
| 485 | Return type: list<dict<string>> or list<any> |
| 486 | |
Bram Moolenaar | 93476fd | 2019-09-06 22:00:54 +0200 | [diff] [blame] | 487 | |
Bram Moolenaar | 6aa5729 | 2021-08-14 21:25:52 +0200 | [diff] [blame] | 488 | sign_getplaced([{buf} [, {dict}]]) *sign_getplaced()* |
Bram Moolenaar | ed997ad | 2019-07-21 16:42:00 +0200 | [diff] [blame] | 489 | Return a list of signs placed in a buffer or all the buffers. |
| 490 | This is similar to the |:sign-place-list| command. |
| 491 | |
Bram Moolenaar | 6aa5729 | 2021-08-14 21:25:52 +0200 | [diff] [blame] | 492 | If the optional buffer name {buf} is specified, then only the |
Bram Moolenaar | ed997ad | 2019-07-21 16:42:00 +0200 | [diff] [blame] | 493 | list of signs placed in that buffer is returned. For the use |
Bram Moolenaar | 6aa5729 | 2021-08-14 21:25:52 +0200 | [diff] [blame] | 494 | of {buf}, see |bufname()|. The optional {dict} can contain |
Bram Moolenaar | ed997ad | 2019-07-21 16:42:00 +0200 | [diff] [blame] | 495 | the following entries: |
| 496 | group select only signs in this group |
| 497 | id select sign with this identifier |
| 498 | lnum select signs placed in this line. For the use |
| 499 | of {lnum}, see |line()|. |
| 500 | If {group} is '*', then signs in all the groups including the |
| 501 | global group are returned. If {group} is not supplied or is an |
| 502 | empty string, then only signs in the global group are |
| 503 | returned. If no arguments are supplied, then signs in the |
| 504 | global group placed in all the buffers are returned. |
| 505 | See |sign-group|. |
| 506 | |
| 507 | Each list item in the returned value is a dictionary with the |
| 508 | following entries: |
| 509 | bufnr number of the buffer with the sign |
| 510 | signs list of signs placed in {bufnr}. Each list |
| 511 | item is a dictionary with the below listed |
| 512 | entries |
| 513 | |
| 514 | The dictionary for each sign contains the following entries: |
Bram Moolenaar | 3132cdd | 2020-11-05 20:41:49 +0100 | [diff] [blame] | 515 | group sign group. Set to '' for the global group. |
| 516 | id identifier of the sign |
| 517 | lnum line number where the sign is placed |
| 518 | name name of the defined sign |
| 519 | priority sign priority |
Bram Moolenaar | ed997ad | 2019-07-21 16:42:00 +0200 | [diff] [blame] | 520 | |
| 521 | The returned signs in a buffer are ordered by their line |
| 522 | number and priority. |
| 523 | |
| 524 | Returns an empty list on failure or if there are no placed |
| 525 | signs. |
| 526 | |
| 527 | Examples: > |
| 528 | " Get a List of signs placed in eval.c in the |
| 529 | " global group |
| 530 | echo sign_getplaced("eval.c") |
| 531 | |
| 532 | " Get a List of signs in group 'g1' placed in eval.c |
| 533 | echo sign_getplaced("eval.c", {'group' : 'g1'}) |
| 534 | |
| 535 | " Get a List of signs placed at line 10 in eval.c |
| 536 | echo sign_getplaced("eval.c", {'lnum' : 10}) |
| 537 | |
| 538 | " Get sign with identifier 10 placed in a.py |
| 539 | echo sign_getplaced("a.py", {'id' : 10}) |
| 540 | |
| 541 | " Get sign with id 20 in group 'g1' placed in a.py |
| 542 | echo sign_getplaced("a.py", {'group' : 'g1', |
| 543 | \ 'id' : 20}) |
| 544 | |
| 545 | " Get a List of all the placed signs |
| 546 | echo sign_getplaced() |
| 547 | < |
Bram Moolenaar | 93476fd | 2019-09-06 22:00:54 +0200 | [diff] [blame] | 548 | Can also be used as a |method|: > |
| 549 | GetBufname()->sign_getplaced() |
| 550 | < |
Christian Brabandt | 5674c9a | 2024-06-09 00:13:43 +0200 | [diff] [blame] | 551 | Return type: list<dict<any>> |
| 552 | |
| 553 | |
| 554 | sign_jump({id}, {group}, {buf}) *sign_jump()* |
Bram Moolenaar | 6aa5729 | 2021-08-14 21:25:52 +0200 | [diff] [blame] | 555 | Open the buffer {buf} or jump to the window that contains |
| 556 | {buf} and position the cursor at sign {id} in group {group}. |
Bram Moolenaar | ed997ad | 2019-07-21 16:42:00 +0200 | [diff] [blame] | 557 | This is similar to the |:sign-jump| command. |
| 558 | |
Yegappan Lakshmanan | 820d552 | 2021-09-17 21:07:35 +0200 | [diff] [blame] | 559 | If {group} is an empty string, then the global group is used. |
Bram Moolenaar | 6aa5729 | 2021-08-14 21:25:52 +0200 | [diff] [blame] | 560 | For the use of {buf}, see |bufname()|. |
Bram Moolenaar | ed997ad | 2019-07-21 16:42:00 +0200 | [diff] [blame] | 561 | |
| 562 | Returns the line number of the sign. Returns -1 if the |
| 563 | arguments are invalid. |
| 564 | |
| 565 | Example: > |
| 566 | " Jump to sign 10 in the current buffer |
| 567 | call sign_jump(10, '', '') |
| 568 | < |
Bram Moolenaar | 93476fd | 2019-09-06 22:00:54 +0200 | [diff] [blame] | 569 | Can also be used as a |method|: > |
| 570 | GetSignid()->sign_jump() |
| 571 | < |
Christian Brabandt | 5674c9a | 2024-06-09 00:13:43 +0200 | [diff] [blame] | 572 | Return type: |Number| |
| 573 | |
| 574 | |
Bram Moolenaar | ed997ad | 2019-07-21 16:42:00 +0200 | [diff] [blame] | 575 | *sign_place()* |
Bram Moolenaar | 6aa5729 | 2021-08-14 21:25:52 +0200 | [diff] [blame] | 576 | sign_place({id}, {group}, {name}, {buf} [, {dict}]) |
Bram Moolenaar | ed997ad | 2019-07-21 16:42:00 +0200 | [diff] [blame] | 577 | Place the sign defined as {name} at line {lnum} in file or |
Bram Moolenaar | 6aa5729 | 2021-08-14 21:25:52 +0200 | [diff] [blame] | 578 | buffer {buf} and assign {id} and {group} to sign. This is |
Bram Moolenaar | ed997ad | 2019-07-21 16:42:00 +0200 | [diff] [blame] | 579 | similar to the |:sign-place| command. |
| 580 | |
| 581 | If the sign identifier {id} is zero, then a new identifier is |
| 582 | allocated. Otherwise the specified number is used. {group} is |
| 583 | the sign group name. To use the global sign group, use an |
| 584 | empty string. {group} functions as a namespace for {id}, thus |
| 585 | two groups can use the same IDs. Refer to |sign-identifier| |
| 586 | and |sign-group| for more information. |
| 587 | |
| 588 | {name} refers to a defined sign. |
Bram Moolenaar | 6aa5729 | 2021-08-14 21:25:52 +0200 | [diff] [blame] | 589 | {buf} refers to a buffer name or number. For the accepted |
Bram Moolenaar | ed997ad | 2019-07-21 16:42:00 +0200 | [diff] [blame] | 590 | values, see |bufname()|. |
| 591 | |
| 592 | The optional {dict} argument supports the following entries: |
| 593 | lnum line number in the file or buffer |
Bram Moolenaar | 6aa5729 | 2021-08-14 21:25:52 +0200 | [diff] [blame] | 594 | {buf} where the sign is to be placed. |
Bram Moolenaar | ed997ad | 2019-07-21 16:42:00 +0200 | [diff] [blame] | 595 | For the accepted values, see |line()|. |
| 596 | priority priority of the sign. See |
| 597 | |sign-priority| for more information. |
| 598 | |
| 599 | If the optional {dict} is not specified, then it modifies the |
| 600 | placed sign {id} in group {group} to use the defined sign |
| 601 | {name}. |
| 602 | |
| 603 | Returns the sign identifier on success and -1 on failure. |
| 604 | |
| 605 | Examples: > |
| 606 | " Place a sign named sign1 with id 5 at line 20 in |
| 607 | " buffer json.c |
| 608 | call sign_place(5, '', 'sign1', 'json.c', |
| 609 | \ {'lnum' : 20}) |
| 610 | |
| 611 | " Updates sign 5 in buffer json.c to use sign2 |
| 612 | call sign_place(5, '', 'sign2', 'json.c') |
| 613 | |
| 614 | " Place a sign named sign3 at line 30 in |
| 615 | " buffer json.c with a new identifier |
| 616 | let id = sign_place(0, '', 'sign3', 'json.c', |
| 617 | \ {'lnum' : 30}) |
| 618 | |
| 619 | " Place a sign named sign4 with id 10 in group 'g3' |
| 620 | " at line 40 in buffer json.c with priority 90 |
| 621 | call sign_place(10, 'g3', 'sign4', 'json.c', |
| 622 | \ {'lnum' : 40, 'priority' : 90}) |
| 623 | < |
Bram Moolenaar | 93476fd | 2019-09-06 22:00:54 +0200 | [diff] [blame] | 624 | Can also be used as a |method|: > |
| 625 | GetSignid()->sign_place(group, name, expr) |
| 626 | < |
Christian Brabandt | 5674c9a | 2024-06-09 00:13:43 +0200 | [diff] [blame] | 627 | Return type: |Number| |
| 628 | |
| 629 | |
| 630 | sign_placelist({list}) *sign_placelist()* |
Bram Moolenaar | ed997ad | 2019-07-21 16:42:00 +0200 | [diff] [blame] | 631 | Place one or more signs. This is similar to the |
| 632 | |sign_place()| function. The {list} argument specifies the |
| 633 | List of signs to place. Each list item is a dict with the |
| 634 | following sign attributes: |
Bram Moolenaar | dd60c36 | 2023-02-27 15:49:53 +0000 | [diff] [blame] | 635 | buffer Buffer name or number. For the accepted |
Bram Moolenaar | ed997ad | 2019-07-21 16:42:00 +0200 | [diff] [blame] | 636 | values, see |bufname()|. |
Bram Moolenaar | dd60c36 | 2023-02-27 15:49:53 +0000 | [diff] [blame] | 637 | group Sign group. {group} functions as a namespace |
Bram Moolenaar | ed997ad | 2019-07-21 16:42:00 +0200 | [diff] [blame] | 638 | for {id}, thus two groups can use the same |
| 639 | IDs. If not specified or set to an empty |
| 640 | string, then the global group is used. See |
| 641 | |sign-group| for more information. |
Bram Moolenaar | dd60c36 | 2023-02-27 15:49:53 +0000 | [diff] [blame] | 642 | id Sign identifier. If not specified or zero, |
Bram Moolenaar | ed997ad | 2019-07-21 16:42:00 +0200 | [diff] [blame] | 643 | then a new unique identifier is allocated. |
| 644 | Otherwise the specified number is used. See |
| 645 | |sign-identifier| for more information. |
Bram Moolenaar | dd60c36 | 2023-02-27 15:49:53 +0000 | [diff] [blame] | 646 | lnum Line number in the buffer where the sign is to |
Bram Moolenaar | f1dcd14 | 2022-12-31 15:30:45 +0000 | [diff] [blame] | 647 | be placed. For the accepted values, see |
| 648 | |line()|. |
Bram Moolenaar | dd60c36 | 2023-02-27 15:49:53 +0000 | [diff] [blame] | 649 | name Name of the sign to place. See |sign_define()| |
| 650 | for more information. |
| 651 | priority Priority of the sign. When multiple signs are |
Bram Moolenaar | ed997ad | 2019-07-21 16:42:00 +0200 | [diff] [blame] | 652 | placed on a line, the sign with the highest |
| 653 | priority is used. If not specified, the |
LemonBoy | b975ddf | 2024-07-06 18:04:09 +0200 | [diff] [blame] | 654 | default value of 10 is used, unless specified |
| 655 | otherwise by the sign definition. See |
Bram Moolenaar | ed997ad | 2019-07-21 16:42:00 +0200 | [diff] [blame] | 656 | |sign-priority| for more information. |
| 657 | |
| 658 | If {id} refers to an existing sign, then the existing sign is |
| 659 | modified to use the specified {name} and/or {priority}. |
| 660 | |
| 661 | Returns a List of sign identifiers. If failed to place a |
| 662 | sign, the corresponding list item is set to -1. |
| 663 | |
| 664 | Examples: > |
| 665 | " Place sign s1 with id 5 at line 20 and id 10 at line |
| 666 | " 30 in buffer a.c |
| 667 | let [n1, n2] = sign_placelist([ |
| 668 | \ {'id' : 5, |
| 669 | \ 'name' : 's1', |
| 670 | \ 'buffer' : 'a.c', |
| 671 | \ 'lnum' : 20}, |
| 672 | \ {'id' : 10, |
| 673 | \ 'name' : 's1', |
| 674 | \ 'buffer' : 'a.c', |
| 675 | \ 'lnum' : 30} |
| 676 | \ ]) |
| 677 | |
| 678 | " Place sign s1 in buffer a.c at line 40 and 50 |
| 679 | " with auto-generated identifiers |
| 680 | let [n1, n2] = sign_placelist([ |
| 681 | \ {'name' : 's1', |
| 682 | \ 'buffer' : 'a.c', |
| 683 | \ 'lnum' : 40}, |
| 684 | \ {'name' : 's1', |
| 685 | \ 'buffer' : 'a.c', |
| 686 | \ 'lnum' : 50} |
| 687 | \ ]) |
| 688 | < |
Bram Moolenaar | 93476fd | 2019-09-06 22:00:54 +0200 | [diff] [blame] | 689 | Can also be used as a |method|: > |
| 690 | GetSignlist()->sign_placelist() |
Christian Brabandt | 5674c9a | 2024-06-09 00:13:43 +0200 | [diff] [blame] | 691 | < |
| 692 | Return type: |Number| |
| 693 | |
Bram Moolenaar | ed997ad | 2019-07-21 16:42:00 +0200 | [diff] [blame] | 694 | |
| 695 | sign_undefine([{name}]) *sign_undefine()* |
| 696 | sign_undefine({list}) |
| 697 | Deletes a previously defined sign {name}. This is similar to |
| 698 | the |:sign-undefine| command. If {name} is not supplied, then |
| 699 | deletes all the defined signs. |
| 700 | |
| 701 | The one argument {list} can be used to undefine a list of |
| 702 | signs. Each list item is the name of a sign. |
| 703 | |
| 704 | Returns 0 on success and -1 on failure. For the one argument |
| 705 | {list} call, returns a list of values one for each undefined |
| 706 | sign. |
| 707 | |
| 708 | Examples: > |
| 709 | " Delete a sign named mySign |
| 710 | call sign_undefine("mySign") |
| 711 | |
| 712 | " Delete signs 'sign1' and 'sign2' |
| 713 | call sign_undefine(["sign1", "sign2"]) |
| 714 | |
| 715 | " Delete all the signs |
| 716 | call sign_undefine() |
| 717 | < |
Bram Moolenaar | 93476fd | 2019-09-06 22:00:54 +0200 | [diff] [blame] | 718 | Can also be used as a |method|: > |
| 719 | GetSignlist()->sign_undefine() |
Christian Brabandt | 5674c9a | 2024-06-09 00:13:43 +0200 | [diff] [blame] | 720 | < |
| 721 | Return type: |Number| |
| 722 | |
Bram Moolenaar | ed997ad | 2019-07-21 16:42:00 +0200 | [diff] [blame] | 723 | |
| 724 | sign_unplace({group} [, {dict}]) *sign_unplace()* |
| 725 | Remove a previously placed sign in one or more buffers. This |
| 726 | is similar to the |:sign-unplace| command. |
| 727 | |
| 728 | {group} is the sign group name. To use the global sign group, |
| 729 | use an empty string. If {group} is set to '*', then all the |
| 730 | groups including the global group are used. |
| 731 | The signs in {group} are selected based on the entries in |
| 732 | {dict}. The following optional entries in {dict} are |
| 733 | supported: |
| 734 | buffer buffer name or number. See |bufname()|. |
| 735 | id sign identifier |
| 736 | If {dict} is not supplied, then all the signs in {group} are |
| 737 | removed. |
| 738 | |
| 739 | Returns 0 on success and -1 on failure. |
| 740 | |
| 741 | Examples: > |
| 742 | " Remove sign 10 from buffer a.vim |
| 743 | call sign_unplace('', {'buffer' : "a.vim", 'id' : 10}) |
| 744 | |
| 745 | " Remove sign 20 in group 'g1' from buffer 3 |
| 746 | call sign_unplace('g1', {'buffer' : 3, 'id' : 20}) |
| 747 | |
| 748 | " Remove all the signs in group 'g2' from buffer 10 |
| 749 | call sign_unplace('g2', {'buffer' : 10}) |
| 750 | |
| 751 | " Remove sign 30 in group 'g3' from all the buffers |
| 752 | call sign_unplace('g3', {'id' : 30}) |
| 753 | |
| 754 | " Remove all the signs placed in buffer 5 |
| 755 | call sign_unplace('*', {'buffer' : 5}) |
| 756 | |
| 757 | " Remove the signs in group 'g4' from all the buffers |
| 758 | call sign_unplace('g4') |
| 759 | |
| 760 | " Remove sign 40 from all the buffers |
| 761 | call sign_unplace('*', {'id' : 40}) |
| 762 | |
| 763 | " Remove all the placed signs from all the buffers |
| 764 | call sign_unplace('*') |
Bram Moolenaar | 93476fd | 2019-09-06 22:00:54 +0200 | [diff] [blame] | 765 | |
| 766 | < Can also be used as a |method|: > |
| 767 | GetSigngroup()->sign_unplace() |
Bram Moolenaar | ed997ad | 2019-07-21 16:42:00 +0200 | [diff] [blame] | 768 | < |
Christian Brabandt | 5674c9a | 2024-06-09 00:13:43 +0200 | [diff] [blame] | 769 | Return type: |Number| |
| 770 | |
| 771 | |
Bram Moolenaar | ed997ad | 2019-07-21 16:42:00 +0200 | [diff] [blame] | 772 | sign_unplacelist({list}) *sign_unplacelist()* |
| 773 | Remove previously placed signs from one or more buffers. This |
| 774 | is similar to the |sign_unplace()| function. |
| 775 | |
| 776 | The {list} argument specifies the List of signs to remove. |
| 777 | Each list item is a dict with the following sign attributes: |
| 778 | buffer buffer name or number. For the accepted |
| 779 | values, see |bufname()|. If not specified, |
| 780 | then the specified sign is removed from all |
| 781 | the buffers. |
| 782 | group sign group name. If not specified or set to an |
| 783 | empty string, then the global sign group is |
| 784 | used. If set to '*', then all the groups |
| 785 | including the global group are used. |
| 786 | id sign identifier. If not specified, then all |
| 787 | the signs in the specified group are removed. |
| 788 | |
| 789 | Returns a List where an entry is set to 0 if the corresponding |
| 790 | sign was successfully removed or -1 on failure. |
| 791 | |
| 792 | Example: > |
| 793 | " Remove sign with id 10 from buffer a.vim and sign |
| 794 | " with id 20 from buffer b.vim |
| 795 | call sign_unplacelist([ |
| 796 | \ {'id' : 10, 'buffer' : "a.vim"}, |
| 797 | \ {'id' : 20, 'buffer' : 'b.vim'}, |
| 798 | \ ]) |
| 799 | < |
Bram Moolenaar | 93476fd | 2019-09-06 22:00:54 +0200 | [diff] [blame] | 800 | Can also be used as a |method|: > |
| 801 | GetSignlist()->sign_unplacelist() |
| 802 | < |
Christian Brabandt | 5674c9a | 2024-06-09 00:13:43 +0200 | [diff] [blame] | 803 | Return type: list<number> or list<any> |
Bram Moolenaar | ed997ad | 2019-07-21 16:42:00 +0200 | [diff] [blame] | 804 | |
Bram Moolenaar | 91f84f6 | 2018-07-29 15:07:52 +0200 | [diff] [blame] | 805 | vim:tw=78:ts=8:noet:ft=help:norl: |