From f2ae5a9cc0b93a4373e15a763c56cd391612c0c4 Mon Sep 17 00:00:00 2001 From: Shougo Matsushita Date: Sat, 20 Feb 2016 12:59:03 +0900 Subject: Add TextYankPost and TextDeletePost autocmds Reviewed by @watiko Ported from https://github.com/Silex/vim/commit/de53ab72c89affa8ba77536ed8920751c037d127 --- runtime/doc/autocmd.txt | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'runtime/doc') diff --git a/runtime/doc/autocmd.txt b/runtime/doc/autocmd.txt index e17281821c..5f36079a39 100644 --- a/runtime/doc/autocmd.txt +++ b/runtime/doc/autocmd.txt @@ -308,6 +308,9 @@ Name triggered by ~ |InsertCharPre| when a character was typed in Insert mode, before inserting it +|TextDeletePost| when some text is deleted (dw, dd, D) +|TextYankPost| when some text is yanked (yw, yd, Y) + |TextChanged| after a change was made to the text in Normal mode |TextChangedI| after a change was made to the text in Insert mode @@ -722,6 +725,24 @@ InsertCharPre When a character is typed in Insert mode, It is not allowed to change the text |textlock|. The event is not triggered when 'paste' is set. + *TextDeletePost* +TextDeletePost Just after a delete (|d|) command is issued. + Not issued if the black hole register + (|quote_|) is used. The affected text can be + accessed by several ways, through @" + (|quotequote| or |v:register|: > + :echo @" + :echo eval('@' . v:register) +< + *TextYankPost* +TextYankPost Just after a |yank| (|y|) command is issued. + Not issued if the black hole register + (|quote_|) is used. The affected text can be + accessed by several ways, through @" + (|quotequote| or |v:register|: > + :echo @" + :echo eval('@' . v:register) +< *InsertEnter* InsertEnter Just before starting Insert mode. Also for Replace mode and Virtual Replace mode. The -- cgit From 7ab9ff88e6c7d234c5e9189521da539d20b5bfa7 Mon Sep 17 00:00:00 2001 From: Björn Linse Date: Mon, 29 Feb 2016 15:27:11 +0100 Subject: eval: add v:event, which will contain data events want to propagate to their receivers. Add helper functions dict_clear and dict_set_keys_readonly. --- runtime/doc/eval.txt | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'runtime/doc') diff --git a/runtime/doc/eval.txt b/runtime/doc/eval.txt index ad736e9c81..bc3dda97a5 100644 --- a/runtime/doc/eval.txt +++ b/runtime/doc/eval.txt @@ -1386,6 +1386,10 @@ v:errors Errors found by assert functions, such as |assert_true()|. < If v:errors is set to anything but a list it is made an empty list by the assert function. + *v:event* *event-variable* +v:event Dictionary of event data for the current |autocommand|. The + available keys differ per event type and are specified at the + documentation for each |event|. *v:exception* *exception-variable* v:exception The value of the exception most recently caught and not finished. See also |v:throwpoint| and |throw-variables|. -- cgit From 2359f6f144206707e2db78f5c3cfd6644f9ffd03 Mon Sep 17 00:00:00 2001 From: Björn Linse Date: Mon, 29 Feb 2016 15:28:10 +0100 Subject: TextYankPost: add information to v:event and update tests --- runtime/doc/autocmd.txt | 31 ++++++++++++------------------- runtime/doc/eval.txt | 14 +++++++++++++- 2 files changed, 25 insertions(+), 20 deletions(-) (limited to 'runtime/doc') diff --git a/runtime/doc/autocmd.txt b/runtime/doc/autocmd.txt index 5f36079a39..ec5818e16f 100644 --- a/runtime/doc/autocmd.txt +++ b/runtime/doc/autocmd.txt @@ -308,8 +308,7 @@ Name triggered by ~ |InsertCharPre| when a character was typed in Insert mode, before inserting it -|TextDeletePost| when some text is deleted (dw, dd, D) -|TextYankPost| when some text is yanked (yw, yd, Y) +|TextYankPost| when some text is yanked or deleted |TextChanged| after a change was made to the text in Normal mode |TextChangedI| after a change was made to the text in Insert mode @@ -725,24 +724,18 @@ InsertCharPre When a character is typed in Insert mode, It is not allowed to change the text |textlock|. The event is not triggered when 'paste' is set. - *TextDeletePost* -TextDeletePost Just after a delete (|d|) command is issued. - Not issued if the black hole register - (|quote_|) is used. The affected text can be - accessed by several ways, through @" - (|quotequote| or |v:register|: > - :echo @" - :echo eval('@' . v:register) -< *TextYankPost* -TextYankPost Just after a |yank| (|y|) command is issued. - Not issued if the black hole register - (|quote_|) is used. The affected text can be - accessed by several ways, through @" - (|quotequote| or |v:register|: > - :echo @" - :echo eval('@' . v:register) -< +TextYankPost Just after a |yank| or |deleting| command, but not + if the black hole register |quote_| is used nor + for |setreg()|. Pattern must be * because its + meaning may change in the future. + Sets these |v:event| keys: + operator + regcontents + regname + regtype + Recursion is ignored. + It is not allowed to change the text |textlock|. *InsertEnter* InsertEnter Just before starting Insert mode. Also for Replace mode and Virtual Replace mode. The diff --git a/runtime/doc/eval.txt b/runtime/doc/eval.txt index bc3dda97a5..51e2b505f5 100644 --- a/runtime/doc/eval.txt +++ b/runtime/doc/eval.txt @@ -1389,7 +1389,19 @@ v:errors Errors found by assert functions, such as |assert_true()|. *v:event* *event-variable* v:event Dictionary of event data for the current |autocommand|. The available keys differ per event type and are specified at the - documentation for each |event|. + documentation for each |event|. The possible keys are: + operator The operation performed. Unlike + |v:operator|, it is set also for an Ex + mode command. For instance, |:yank| is + translated to "|y|". + regcontents Text stored in the register as a + |readfile()|-style list of lines. + regname Requested register (e.g "x" for "xyy) + or the empty string for an unnamed + operation. + regtype Type of register as returned by + |getregtype()|. + *v:exception* *exception-variable* v:exception The value of the exception most recently caught and not finished. See also |v:throwpoint| and |throw-variables|. -- cgit