From fb9abd7d993cf2166b73810c7621f432bedd325d Mon Sep 17 00:00:00 2001 From: Andrej Zieger Date: Tue, 7 May 2019 08:26:09 +0200 Subject: vim-patch:8.1.0614: placing signs can be complicated Problem: Placing signs can be complicated. Solution: Add functions for defining and placing signs. Introduce a group name to avoid different plugins using the same signs. (Yegappan Lakshmanan, closes vim/vim#3652) https://github.com/vim/vim/commit/162b71479bd4dcdb3a2ef9198a1444f6f99e6843 --- runtime/doc/eval.txt | 224 +++++++++++++++++++++++++++++++++++++++++++++++++ runtime/doc/sign.txt | 97 ++++++++++++++++++++- runtime/doc/usr_41.txt | 9 ++ 3 files changed, 329 insertions(+), 1 deletion(-) (limited to 'runtime') diff --git a/runtime/doc/eval.txt b/runtime/doc/eval.txt index dfffe33b1f..21846d4cbb 100644 --- a/runtime/doc/eval.txt +++ b/runtime/doc/eval.txt @@ -2289,6 +2289,15 @@ shellescape({string} [, {special}]) String escape {string} for use as shell command argument shiftwidth() Number effective value of 'shiftwidth' +sign_define({name} [, {dict}]) Number define or update a sign +sign_getdefined([{name}]) List get a list of defined signs +sign_getplaced([{expr} [, {dict}]]) + List get a list of placed signs +sign_place({id}, {group}, {name}, {expr} [, {dict}]) + Number place a sign +sign_undefine([{name}]) Number undefine a sign +sign_unplace({group} [, {dict}]) + Number unplace a sign simplify({filename}) String simplify filename as much as possible sin({expr}) Float sine of {expr} sinh({expr}) Float hyperbolic sine of {expr} @@ -7349,7 +7358,222 @@ shiftwidth() *shiftwidth()* endif < And then use s:sw() instead of &sw. +sign_define({name} [, {dict}]) *sign_define()* + Define a new sign named {name} or modify the attributes of an + existing sign. This is similar to the |:sign-define| command. + Prefix {name} with a unique text to avoid name collisions. + There is no {group} like with placing signs. + + The {name} can be a String or a Number. The optional {dict} + argument specifies the sign attributes. The following values + are supported: + icon full path to the bitmap file for the sign. + linehl highlight group used for the whole line the + sign is placed in. + text text that is displayed when there is no icon + or the GUI is not being used. + texthl highlight group used for the text item + numhl highlight group used for 'number' column at the + associated line. Overrides |hl-LineNr|, + |hl-CursorLineNr|. + + Returns 0 on success and -1 on failure. + + Examples: > + call sign_define("mySign", {"text" : "=>", "texthl" : + \ "Error", "linehl" : "Search"}) +< +sign_getdefined([{name}]) *sign_getdefined()* + Get a list of defined signs and their attributes. + This is similar to the |:sign-list| command. + + If the {name} is not supplied, then a list of all the defined + signs is returned. Otherwise the attribute of the specified + sign is returned. + + Each list item in the returned value is a dictionary with the + following entries: + icon full path to the bitmap file of the sign + linehl highlight group used for the whole line the + sign is placed in. + name name of the sign + text text that is displayed when there is no icon + or the GUI is not being used. + texthl highlight group used for the text item + numhl highlight group used for 'number' column at the + associated line. Overrides |hl-LineNr|, + |hl-CursorLineNr|. + + Returns an empty List if there are no signs and when {name} is + not found. + + Examples: > + " Get a list of all the defined signs + echo sign_getdefined() + + " Get the attribute of the sign named mySign + echo sign_getdefined("mySign") +< +sign_getplaced([{expr} [, {dict}]]) *sign_getplaced()* + Return a list of signs placed in a buffer or all the buffers. + This is similar to the |:sign-place-list| command. + + If the optional buffer name {expr} is specified, then only the + list of signs placed in that buffer is returned. For the use + of {expr}, see |bufname()|. The optional {dict} can contain + the following entries: + group select only signs in this group + id select sign with this identifier + lnum select signs placed in this line. For the use + of {lnum}, see |line()|. + If {group} is '*', then signs in all the groups including the + global group are returned. If {group} is not supplied, then + only signs in the global group are returned. If no arguments + are supplied, then signs in the global group placed in all the + buffers are returned. + + Each list item in the returned value is a dictionary with the + following entries: + bufnr number of the buffer with the sign + signs list of signs placed in {bufnr}. Each list + item is a dictionary with the below listed + entries + + The dictionary for each sign contains the following entries: + group sign group. Set to '' for the global group. + id identifier of the sign + lnum line number where the sign is placed + name name of the defined sign + priority sign priority + + Returns an empty list on failure. + + Examples: > + " Get a List of signs placed in eval.c in the + " global group + echo sign_getplaced("eval.c") + + " Get a List of signs in group 'g1' placed in eval.c + echo sign_getplaced("eval.c", {'group' : 'g1'}) + + " Get a List of signs placed at line 10 in eval.c + echo sign_getplaced("eval.c", {'lnum' : 10}) + + " Get sign with identifier 10 placed in a.py + echo sign_getplaced("a.py", {'id' : 10'}) + + " Get sign with id 20 in group 'g1' placed in a.py + echo sign_getplaced("a.py", {'group' : 'g1', + \ 'id' : 20'}) + + " Get a List of all the placed signs + echo sign_getplaced() +< + *sign_place()* +sign_place({id}, {group}, {name}, {expr} [, {dict}]) + Place the sign defined as {name} at line {lnum} in file {expr} + and assign {id} and {group} to sign. This is similar to the + |:sign-place| command. + + If the sign identifier {id} is zero, then a new identifier is + allocated. Otherwise the specified number is used. {group} is + the sign group name. To use the global sign group, use an + empty string. {group} functions as a namespace for {id}, thus + two groups can use the same IDs. + + {name} refers to a defined sign. + {expr} refers to a buffer name or number. For the accepted + values, see |bufname()|. + + The optional {dict} argument supports the following entries: + lnum line number in the buffer {expr} where + the sign is to be placed. For the + accepted values, see |line()|. + priority priority of the sign. See + |sign-priority| for more information. + + If the optional {dict} is not specified, then it modifies the + placed sign {id} in group {group} to use the defined sign + {name}. + + Returns the sign identifier on success and -1 on failure. + + Examples: > + " Place a sign named sign1 with id 5 at line 20 in + " buffer json.c + call sign_place(5, '', 'sign1', 'json.c', + \ {'lnum' : 20}) + + " Updates sign 5 in buffer json.c to use sign2 + call sign_place(5, '', 'sign2', 'json.c') + + " Place a sign named sign3 at line 30 in + " buffer json.c with a new identifier + let id = sign_place(0, '', 'sign3', 'json.c', + \ {'lnum' : 30}) + + " Place a sign named sign4 with id 10 in group 'g3' + " at line 40 in buffer json.c with priority 90 + call sign_place(10, 'g3', 'sign4', 'json.c', + \ {'lnum' : 40, 'priority' : 90}) +< +sign_undefine([{name}]) *sign_undefine()* + Deletes a previously defined sign {name}. This is similar to + the |:sign-undefine| command. If {name} is not supplied, then + deletes all the defined signs. + + Returns 0 on success and -1 on failure. + + Examples: > + " Delete a sign named mySign + call sign_undefine("mySign") + + " Delete all the signs + call sign_undefine() +< +sign_unplace({group} [, {dict}]) *sign_unplace()* + Remove a previously placed sign in one or more buffers. This + is similar to the |:sign-unplace()| command. + + {group} is the sign group name. To use the global sign group, + use an empty string. If {group} is set to '*', then all the + groups including the global group are used. + The signs in {group} are selected based on the entries in + {dict}. The following optional entries in {dict} are + supported: + buffer buffer name or number. See |bufname()|. + id sign identifier + If {dict} is not supplied, then all the signs in {group} are + removed. + + Returns 0 on success and -1 on failure. + + Examples: > + " Remove sign 10 from buffer a.vim + call sign_unplace('', {'buffer' : "a.vim", 'id' : 10}) + + " Remove sign 20 in group 'g1' from buffer 3 + call sign_unplace('g1', {'buffer' : 3, 'id' : 20}) + + " Remove all the signs in group 'g2' from buffer 10 + call sign_unplace('g2', {'buffer' : 10}) + + " Remove sign 30 in group 'g3' from all the buffers + call sign_unplace('g3', {'id' : 30}) + + " Remove all the signs placed in buffer 5 + call sign_unplace('*', {'buffer' : 5}) + + " Remove the signs in group 'g4' from all the buffers + call sign_unplace('g4') + + " Remove sign 40 from all the buffers + call sign_unplace('*', {'id' : 40}) + + " Remove all the placed signs from all the buffers + call sign_unplace('*') +< simplify({filename}) *simplify()* Simplify the file name as much as possible without changing the meaning. Shortcuts (on MS-Windows) or symbolic links (on diff --git a/runtime/doc/sign.txt b/runtime/doc/sign.txt index 273d2b984c..39c1c61da2 100644 --- a/runtime/doc/sign.txt +++ b/runtime/doc/sign.txt @@ -45,6 +45,20 @@ The color of the column is set with the SignColumn group |hl-SignColumn|. Example to set the color: > :highlight SignColumn guibg=darkgrey +< + *sign-group* +Each sign can be assigned to either the global group or a named group. When +placing a sign, if a group name is not supplied, or an empty string is used, +then the sign is placed in the global group. Otherwise the sign is placed in +the named group. The sign identifier is unique within a group. The sign group +allows Vim plugins to use unique signs without interfering with other plugins +using signs. + + *sign-priority* +Each placed sign is assigned a priority value. When multiple signs are placed +on the same line, the attributes of the sign with the highest priority is used +independent of the sign group. The default priority for a sign is 10. The +priority is assigned at the time of placing a sign. ============================================================================== 2. Commands *sign-commands* *:sig* *:sign* @@ -63,6 +77,8 @@ comment. If you do need that, use the |:execute| command. DEFINING A SIGN. *:sign-define* *E255* *E160* *E612* +See |sign_define()| for the equivalent Vim script function. + :sign define {name} {argument}... Define a new sign or set attributes for an existing sign. The {name} can either be a number (all digits) or a name @@ -99,13 +115,18 @@ DEFINING A SIGN. *:sign-define* *E255* *E160* *E612* DELETING A SIGN *:sign-undefine* *E155* +See |sign_undefine()| for the equivalent Vim script function. + :sign undefine {name} Deletes a previously defined sign. If signs with this {name} are still placed this will cause trouble. + LISTING SIGNS *:sign-list* *E156* +See |sign_getdefined()| for the equivalent Vim script function. + :sign list Lists all defined signs and their attributes. :sign list {name} @@ -114,6 +135,8 @@ LISTING SIGNS *:sign-list* *E156* PLACING SIGNS *:sign-place* *E158* +See |sign_place()| for the equivalent Vim script function. + :sign place {id} line={lnum} name={name} file={fname} Place sign defined as {name} at line {lnum} in file {fname}. *:sign-fname* @@ -129,6 +152,25 @@ PLACING SIGNS *:sign-place* *E158* to be done several times and making changes may not work as expected). + The following optional sign attributes can be specified before + "file=": + group={group} Place sign in sign group {group} + priority={prio} Assign priority {prio} to sign + + By default, the sign is placed in the global sign group. + + By default, the sign is assigned a default priority of 10. To + assign a different priority value, use "priority={prio}" to + specify a value. The priority is used to determine the + highlight group used when multiple signs are placed on the + same line. + + Examples: > + :sign place 5 line=3 name=sign1 file=a.py + :sign place 6 group=g2 line=2 name=sign2 file=x.py + :sign place 9 group=g2 priority=50 line=5 + \ name=sign1 file=a.py +< :sign place {id} line={lnum} name={name} buffer={nr} Same, but use buffer {nr}. @@ -139,31 +181,73 @@ PLACING SIGNS *:sign-place* *E158* This can be used to change the displayed sign without moving it (e.g., when the debugger has stopped at a breakpoint). + The optional "group={group}" attribute can be used before + "file=" to select a sign in a particular group. + :sign place {id} name={name} buffer={nr} Same, but use buffer {nr}. REMOVING SIGNS *:sign-unplace* *E159* +See |sign_unplace()| for the equivalent Vim script function. + :sign unplace {id} file={fname} Remove the previously placed sign {id} from file {fname}. See remark above about {fname} |:sign-fname|. +:sign unplace {id} group={group} file={fname} + Same but remove the sign {id} in sign group {group}. + +:sign unplace {id} group=* file={fname} + Same but remove the sign {id} from all the sign groups. + :sign unplace * file={fname} Remove all placed signs in file {fname}. +:sign unplace * group={group} file={fname} + Remove all placed signs in group {group} from file {fname}. + +:sign unplace * group=* file={fname} + Remove all placed signs in all the groups from file {fname}. + :sign unplace {id} buffer={nr} Remove the previously placed sign {id} from buffer {nr}. +:sign unplace {id} group={group} buffer={nr} + Remove the previously placed sign {id} in group {group} from + buffer {nr}. + +:sign unplace {id} group=* buffer={nr} + Remove the previously placed sign {id} in all the groups from + buffer {nr}. + :sign unplace * buffer={nr} Remove all placed signs in buffer {nr}. +:sign unplace * group={group} buffer={nr} + Remove all placed signs in group {group} from buffer {nr}. + +:sign unplace * group=* buffer={nr} + Remove all placed signs in all the groups from buffer {nr}. + :sign unplace {id} Remove the previously placed sign {id} from all files it appears in. +:sign unplace {id} group={group} + Remove the previously placed sign {id} in group {group} from + all files it appears in. + +:sign unplace {id} group=* + Remove the previously placed sign {id} in all the groups from + all the files it appears in. + :sign unplace * - Remove all placed signs. + Remove all placed signs in the global group. + +:sign unplace * group=* + Remove all placed signs in all the groups. :sign unplace Remove the placed sign at the cursor position. @@ -171,15 +255,26 @@ REMOVING SIGNS *:sign-unplace* *E159* LISTING PLACED SIGNS *:sign-place-list* +See |sign_getplaced()| for the equivalent Vim script function. + :sign place file={fname} List signs placed in file {fname}. See remark above about {fname} |:sign-fname|. +:sign place group={group} file={fname} + List signs in group {group} placed in file {fname}. + :sign place buffer={nr} List signs placed in buffer {nr}. +:sign place group={group} buffer={nr} + List signs in group {group} placed in buffer {nr}. + :sign place List placed signs in all files. +:sign place group={group} + List placed signs in all sign groups in all the files. + JUMPING TO A SIGN *:sign-jump* *E157* diff --git a/runtime/doc/usr_41.txt b/runtime/doc/usr_41.txt index 234aba1932..cfda4fdb31 100644 --- a/runtime/doc/usr_41.txt +++ b/runtime/doc/usr_41.txt @@ -916,6 +916,15 @@ Mappings: *mapping-functions* maparg() get rhs of a mapping wildmenumode() check if the wildmode is active +Signs: *sign-functions* + sign_define() define or update a sign + sign_getdefined() get a list of defined signs + sign_getplaced() get a list of placed signs + sign_place() place a sign + sign_undefine() undefine a sign + sign_unplace() unplace a sign + + Testing: *test-functions* assert_equal() assert that two expressions values are equal assert_notequal() assert that two expressions values are not equal -- cgit From 3ee55edd2e27dd66c3bf8c319929beb0a6426bb3 Mon Sep 17 00:00:00 2001 From: Andrej Zieger Date: Wed, 15 May 2019 22:02:10 +0200 Subject: vim-patch:8.1.0644: finding next sign ID is inefficient Problem: Finding next sign ID is inefficient. Solution: Add next_sign_id. (Yegappan Lakshmanan, closes vim/vim#3717) https://github.com/vim/vim/commit/6436cd83f90a0efc326798792e49e8ff96a43dce --- runtime/doc/eval.txt | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'runtime') diff --git a/runtime/doc/eval.txt b/runtime/doc/eval.txt index 21846d4cbb..028a4e9b7a 100644 --- a/runtime/doc/eval.txt +++ b/runtime/doc/eval.txt @@ -7428,10 +7428,10 @@ sign_getplaced([{expr} [, {dict}]]) *sign_getplaced()* lnum select signs placed in this line. For the use of {lnum}, see |line()|. If {group} is '*', then signs in all the groups including the - global group are returned. If {group} is not supplied, then - only signs in the global group are returned. If no arguments - are supplied, then signs in the global group placed in all the - buffers are returned. + global group are returned. If {group} is not supplied or is an + empty string, then only signs in the global group are + returned. If no arguments are supplied, then signs in the + global group placed in all the buffers are returned. Each list item in the returned value is a dictionary with the following entries: -- cgit From 09c236ba5c03732a7d7aa5f14f602d6f130f0057 Mon Sep 17 00:00:00 2001 From: Andrej Zieger Date: Thu, 16 May 2019 21:27:41 +0200 Subject: vim-patch:8.1.0658: deleting signs and completion for :sign is insufficient Problem: Deleting signs and completion for :sign is insufficient. Solution: Add deleting signs in a specified or any group from the current cursor location. Add group and priority to sign command completion. Add tests for different sign unplace commands. Update help text. Add tests for sign jump with group. Update help for sign jump. (Yegappan Lakshmanan, closes vim/vim#3731) https://github.com/vim/vim/commit/7d83bf4f2b785b46d87c7bc376fc9d0a862af782 --- runtime/doc/sign.txt | 33 +++++++++++++++++++++++++++++---- 1 file changed, 29 insertions(+), 4 deletions(-) (limited to 'runtime') diff --git a/runtime/doc/sign.txt b/runtime/doc/sign.txt index 39c1c61da2..4b9c64e575 100644 --- a/runtime/doc/sign.txt +++ b/runtime/doc/sign.txt @@ -244,13 +244,24 @@ See |sign_unplace()| for the equivalent Vim script function. all the files it appears in. :sign unplace * - Remove all placed signs in the global group. + Remove placed signs in the global group from all the files. + +:sign unplace * group={group} + Remove placed signs in group {group} from all the files. :sign unplace * group=* - Remove all placed signs in all the groups. + Remove placed signs in all the groups from all the files. :sign unplace - Remove the placed sign at the cursor position. + Remove a placed sign at the cursor position. If multiple signs + are placed in the line, then only one is removed. + +:sign unplace group={group} + Remove a placed sign in group {group} at the cursor + position. + +:sign unplace group=* + Remove a placed sign in any group at the cursor position. LISTING PLACED SIGNS *:sign-place-list* @@ -264,17 +275,25 @@ See |sign_getplaced()| for the equivalent Vim script function. :sign place group={group} file={fname} List signs in group {group} placed in file {fname}. +:sign place group=* file={fname} + List signs in all the groups placed in file {fname}. + + :sign place buffer={nr} List signs placed in buffer {nr}. :sign place group={group} buffer={nr} List signs in group {group} placed in buffer {nr}. -:sign place List placed signs in all files. +:sign place group=* buffer={nr} + List signs in all the groups placed in buffer {nr}. :sign place group={group} List placed signs in all sign groups in all the files. +:sign place group=* + List placed signs in all sign groups in all files. + JUMPING TO A SIGN *:sign-jump* *E157* @@ -285,9 +304,15 @@ JUMPING TO A SIGN *:sign-jump* *E157* If the file isn't displayed in window and the current file can not be |abandon|ed this fails. +:sign jump {id} group={group} file={fname} + Same but jump to the sign in group {group} + :sign jump {id} buffer={nr} *E934* Same, but use buffer {nr}. This fails if buffer {nr} does not have a name. +:sign jump {id} group={group} buffer={nr} + Same but jump to the sign in group {group} + vim:tw=78:ts=8:noet:ft=help:norl: -- cgit From e70609cfac9c64bdf221fa902bba788883e97540 Mon Sep 17 00:00:00 2001 From: Andrej Zieger Date: Sun, 19 May 2019 21:14:30 +0200 Subject: vim-patch:8.1.0697: ":sign place" requires the buffer argument Problem: ":sign place" requires the buffer argument. Solution: Make the argument optional. Also update the help and clean up the sign test. (Yegappan Lakshmanan, closes vim/vim#3767) https://github.com/vim/vim/commit/b328cca2548936c5f68fff683049a929882f5011 --- runtime/doc/eval.txt | 23 ++++++++++++++++++----- runtime/doc/sign.txt | 39 ++++++++++++++++++++++++++------------- 2 files changed, 44 insertions(+), 18 deletions(-) (limited to 'runtime') diff --git a/runtime/doc/eval.txt b/runtime/doc/eval.txt index 028a4e9b7a..c56e4cdef2 100644 --- a/runtime/doc/eval.txt +++ b/runtime/doc/eval.txt @@ -3581,20 +3581,24 @@ extend({expr1}, {expr2} [, {expr3}]) *extend()* feedkeys({string} [, {mode}]) *feedkeys()* Characters in {string} are queued for processing as if they come from a mapping or were typed by the user. + By default the string is added to the end of the typeahead buffer, thus if a mapping is still being executed the characters come after them. Use the 'i' flag to insert before other characters, they will be executed next, before any characters from a mapping. + The function does not wait for processing of keys contained in {string}. + To include special keys into {string}, use double-quotes and "\..." notation |expr-quote|. For example, feedkeys("\") simulates pressing of the key. But feedkeys('\') pushes 5 characters. - If {mode} is absent, keys are remapped. + {mode} is a String, which can contain these character flags: - 'm' Remap keys. This is default. + 'm' Remap keys. This is default. If {mode} is absent, + keys are remapped. 'n' Do not remap keys. 't' Handle keys as if typed; otherwise they are handled as if coming from a mapping. This matters for undo, @@ -3608,6 +3612,9 @@ feedkeys({string} [, {mode}]) *feedkeys()* will behave as if is typed, to avoid getting stuck, waiting for a character to be typed before the script continues. + Note that if you manage to call feedkeys() while + executing commands, thus calling it recursively, the + all typehead will be consumed by the last call. '!' When used with 'x' will not end Insert mode. Can be used in a test when a timer is set to exit Insert mode a little later. Useful for testing CursorHoldI. @@ -7378,6 +7385,9 @@ sign_define({name} [, {dict}]) *sign_define()* associated line. Overrides |hl-LineNr|, |hl-CursorLineNr|. + If the sign named {name} already exists, then the attributes + of the sign are updated. + Returns 0 on success and -1 on failure. Examples: > @@ -7432,6 +7442,7 @@ sign_getplaced([{expr} [, {dict}]]) *sign_getplaced()* empty string, then only signs in the global group are returned. If no arguments are supplied, then signs in the global group placed in all the buffers are returned. + See |sign-group|. Each list item in the returned value is a dictionary with the following entries: @@ -7447,7 +7458,8 @@ sign_getplaced([{expr} [, {dict}]]) *sign_getplaced()* name name of the defined sign priority sign priority - Returns an empty list on failure. + Returns an empty list on failure or if there are no placed + signs. Examples: > " Get a List of signs placed in eval.c in the @@ -7480,7 +7492,8 @@ sign_place({id}, {group}, {name}, {expr} [, {dict}]) allocated. Otherwise the specified number is used. {group} is the sign group name. To use the global sign group, use an empty string. {group} functions as a namespace for {id}, thus - two groups can use the same IDs. + two groups can use the same IDs. Refer to |sign-identifier| + for more information. {name} refers to a defined sign. {expr} refers to a buffer name or number. For the accepted @@ -8576,7 +8589,7 @@ undofile({name}) *undofile()* If {name} is empty undofile() returns an empty string, since a buffer without a file name will not write an undo file. Useful in combination with |:wundo| and |:rundo|. - When compiled without the +persistent_undo option this always + When compiled without the |+persistent_undo| option this always returns an empty string. undotree() *undotree()* diff --git a/runtime/doc/sign.txt b/runtime/doc/sign.txt index 4b9c64e575..cbc3a19399 100644 --- a/runtime/doc/sign.txt +++ b/runtime/doc/sign.txt @@ -46,13 +46,23 @@ Example to set the color: > :highlight SignColumn guibg=darkgrey < + *sign-identifier* +Each placed sign is identified by a number called the sign identifier. This +identifier is used to jump to the sign or to remove the sign. The identifier +is assigned when placing the sign using the |sign-place| command or the +|sign_place()| function. Each sign identifier should be a unique number. If +multiple placed signs use the same identifier, then jumping to or removing a +sign becomes unpredictable. To avoid overlapping identifiers, sign groups can +be used. The |sign_place()| function can be called with a zero sign identifier +to allocate the next available identifier. + *sign-group* -Each sign can be assigned to either the global group or a named group. When -placing a sign, if a group name is not supplied, or an empty string is used, -then the sign is placed in the global group. Otherwise the sign is placed in -the named group. The sign identifier is unique within a group. The sign group -allows Vim plugins to use unique signs without interfering with other plugins -using signs. +Each placed sign can be assigned to either the global group or a named group. +When placing a sign, if a group name is not supplied, or an empty string is +used, then the sign is placed in the global group. Otherwise the sign is +placed in the named group. The sign identifier is unique within a group. The +sign group allows Vim plugins to use unique signs without interfering with +other plugins using signs. *sign-priority* Each placed sign is assigned a priority value. When multiple signs are placed @@ -171,8 +181,9 @@ See |sign_place()| for the equivalent Vim script function. :sign place 9 group=g2 priority=50 line=5 \ name=sign1 file=a.py < -:sign place {id} line={lnum} name={name} buffer={nr} - Same, but use buffer {nr}. +:sign place {id} line={lnum} name={name} [buffer={nr}] + Same, but use buffer {nr}. If the buffer argument is not + given, place the sign in the current buffer. *E885* :sign place {id} name={name} file={fname} @@ -184,8 +195,9 @@ See |sign_place()| for the equivalent Vim script function. The optional "group={group}" attribute can be used before "file=" to select a sign in a particular group. -:sign place {id} name={name} buffer={nr} - Same, but use buffer {nr}. +:sign place {id} name={name} [buffer={nr}] + Same, but use buffer {nr}. If the buffer argument is not + given, use the current buffer. REMOVING SIGNS *:sign-unplace* *E159* @@ -307,11 +319,12 @@ JUMPING TO A SIGN *:sign-jump* *E157* :sign jump {id} group={group} file={fname} Same but jump to the sign in group {group} -:sign jump {id} buffer={nr} *E934* +:sign jump {id} [buffer={nr}] *E934* Same, but use buffer {nr}. This fails if buffer {nr} does not - have a name. + have a name. If the buffer argument is not given, use the + current buffer. -:sign jump {id} group={group} buffer={nr} +:sign jump {id} group={group} [buffer={nr}] Same but jump to the sign in group {group} -- cgit From f43900f6865cb9f7b70621b090194448920d66e5 Mon Sep 17 00:00:00 2001 From: Andrej Zieger Date: Mon, 20 May 2019 11:04:58 +0200 Subject: vim-patch:8.1.0702: ":sign place" only uses the current buffer Problem: ":sign place" only uses the current buffer. Solution: List signs for all buffers when there is no buffer argument. Fix error message for invalid buffer name in sign_place(). (Yegappan Lakshmanan, closes vim/vim#3774) https://github.com/vim/vim/commit/b589f95b38ddd779d7e696abb0ea011dc92ea903 --- runtime/doc/eval.txt | 3 +++ 1 file changed, 3 insertions(+) (limited to 'runtime') diff --git a/runtime/doc/eval.txt b/runtime/doc/eval.txt index c56e4cdef2..77df15bf41 100644 --- a/runtime/doc/eval.txt +++ b/runtime/doc/eval.txt @@ -7458,6 +7458,9 @@ sign_getplaced([{expr} [, {dict}]]) *sign_getplaced()* name name of the defined sign priority sign priority + The returned signs in a buffer are ordered by their line + number. + Returns an empty list on failure or if there are no placed signs. -- cgit From fa07cc215d6c7e86e3b4b7a83d856c017a655933 Mon Sep 17 00:00:00 2001 From: Andrej Zieger Date: Mon, 20 May 2019 13:12:30 +0200 Subject: vim-patch:8.1.0717: there is no function for the ":sign jump" command Problem: There is no function for the ":sign jump" command. Solution: Add the sign_jump() function. (Yegappan Lakshmanan, closes vim/vim#3780) https://github.com/vim/vim/commit/6b7b7190aa9e5c4f51bceaebf9275aa5097cfea1 --- runtime/doc/eval.txt | 17 +++++++++++++++++ runtime/doc/sign.txt | 8 +++++--- runtime/doc/usr_41.txt | 1 + 3 files changed, 23 insertions(+), 3 deletions(-) (limited to 'runtime') diff --git a/runtime/doc/eval.txt b/runtime/doc/eval.txt index 77df15bf41..f6e8cdf762 100644 --- a/runtime/doc/eval.txt +++ b/runtime/doc/eval.txt @@ -2293,6 +2293,8 @@ sign_define({name} [, {dict}]) Number define or update a sign sign_getdefined([{name}]) List get a list of defined signs sign_getplaced([{expr} [, {dict}]]) List get a list of placed signs +sign_jump({id}, {group}, {expr}) + Number jump to a sign sign_place({id}, {group}, {name}, {expr} [, {dict}]) Number place a sign sign_undefine([{name}]) Number undefine a sign @@ -7484,6 +7486,21 @@ sign_getplaced([{expr} [, {dict}]]) *sign_getplaced()* " Get a List of all the placed signs echo sign_getplaced() +< + *sign_jump()* +sign_jump({id}, {group}, {expr}) + Open the buffer {expr} or jump to the window that contains + {expr} and position the cursor at sign {id} in group {group}. + This is similar to the |:sign-jump| command. + + For the use of {expr}, see |bufname()|. + + Returns the line number of the sign. Returns -1 if the + arguments are invalid. + + Example: > + " Jump to sign 10 in the current buffer + call sign_jump(10, '', '') < *sign_place()* sign_place({id}, {group}, {name}, {expr} [, {dict}]) diff --git a/runtime/doc/sign.txt b/runtime/doc/sign.txt index cbc3a19399..cf7e01bcea 100644 --- a/runtime/doc/sign.txt +++ b/runtime/doc/sign.txt @@ -256,13 +256,13 @@ See |sign_unplace()| for the equivalent Vim script function. all the files it appears in. :sign unplace * - Remove placed signs in the global group from all the files. + Remove all placed signs in the global group from all the files. :sign unplace * group={group} - Remove placed signs in group {group} from all the files. + Remove all placed signs in group {group} from all the files. :sign unplace * group=* - Remove placed signs in all the groups from all the files. + Remove all placed signs in all the groups from all the files. :sign unplace Remove a placed sign at the cursor position. If multiple signs @@ -309,6 +309,8 @@ See |sign_getplaced()| for the equivalent Vim script function. JUMPING TO A SIGN *:sign-jump* *E157* +See |sign_jump()| for the equivalent Vim script function. + :sign jump {id} file={fname} Open the file {fname} or jump to the window that contains {fname} and position the cursor at sign {id}. diff --git a/runtime/doc/usr_41.txt b/runtime/doc/usr_41.txt index cfda4fdb31..b8fd6cdf7b 100644 --- a/runtime/doc/usr_41.txt +++ b/runtime/doc/usr_41.txt @@ -920,6 +920,7 @@ Signs: *sign-functions* sign_define() define or update a sign sign_getdefined() get a list of defined signs sign_getplaced() get a list of placed signs + sign_jump() jump to a sign sign_place() place a sign sign_undefine() undefine a sign sign_unplace() unplace a sign -- cgit From 237cecd81b83dcbdac05b208ea6adc3357039858 Mon Sep 17 00:00:00 2001 From: Andrej Zieger Date: Tue, 21 May 2019 21:50:59 +0200 Subject: vim-patch:8.1.0039: cannot easily delete lines in another buffer Problem: Cannot easily delete lines in another buffer. Solution: Add deletebufline(). https://github.com/vim/vim/commit/d79a26219d7161e9211fd144f0e874aa5f6d251e --- runtime/doc/eval.txt | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'runtime') diff --git a/runtime/doc/eval.txt b/runtime/doc/eval.txt index f6e8cdf762..cd5632e70c 100644 --- a/runtime/doc/eval.txt +++ b/runtime/doc/eval.txt @@ -2028,6 +2028,8 @@ cursor({lnum}, {col} [, {off}]) cursor({list}) Number move cursor to position in {list} deepcopy({expr} [, {noref}]) any make a full copy of {expr} delete({fname} [, {flags}]) Number delete the file or directory {fname} +deletebufline({expr}, {first}[, {last}]) + Number delete lines from buffer {expr} dictwatcheradd({dict}, {pattern}, {callback}) Start watching a dictionary dictwatcherdel({dict}, {pattern}, {callback}) @@ -3209,6 +3211,17 @@ delete({fname} [, {flags}]) *delete()* The result is a Number, which is 0 if the delete operation was successful and -1 when the deletion failed or partly failed. +deletebufline({expr}, {first}[, {last}]) *deletebufline()* + Delete lines {first} to {last} (inclusive) from buffer {expr}. + If {last} is omitted then delete line {first} only. + On success 0 is returned, on failure 1 is returned. + + For the use of {expr}, see |bufname()| above. + + {first} and {last} are used like with |setline()|. Note that + when using |line()| this refers to the current buffer. Use "$" + to refer to the last line in buffer {expr}. + dictwatcheradd({dict}, {pattern}, {callback}) *dictwatcheradd()* Adds a watcher to a dictionary. A dictionary watcher is identified by three components: -- cgit