patch 8.0.1394: cannot intercept a yank command
Problem: Cannot intercept a yank command.
Solution: Add the TextYankPost autocommand event. (Philippe Vaucher et al.,
closes #2333)
diff --git a/runtime/doc/autocmd.txt b/runtime/doc/autocmd.txt
index 06931df..a47050e 100644
--- a/runtime/doc/autocmd.txt
+++ b/runtime/doc/autocmd.txt
@@ -330,6 +330,7 @@
|TextChanged| after a change was made to the text in Normal mode
|TextChangedI| after a change was made to the text in Insert mode
+|TextYankPost| after text is yanked or deleted
|ColorScheme| after loading a color scheme
@@ -956,6 +957,26 @@
current buffer in Insert mode.
Not triggered when the popup menu is visible.
Otherwise the same as TextChanged.
+ |TextYankPost|
+TextYankPost After text has been yanked or deleted in the
+ current buffer. The following values of
+ |v:event| can be used to determine the operation
+ that triggered this autocmd:
+ operator The operation performed.
+ regcontents Text that was stored in the
+ register, as a list of lines,
+ like with: >
+ getreg(r, 1, 1)
+< regname Name of the |register| or
+ empty string for the unnamed
+ register.
+ regtype Type of the register, see
+ |getregtype()|.
+ Not triggered when |quote_| is used nor when
+ called recursively.
+ It is not allowed to change the buffer text,
+ see |textlock|.
+
*User*
User Never executed automatically. To be used for
autocommands that are only executed with
diff --git a/runtime/doc/eval.txt b/runtime/doc/eval.txt
index 977ff71..09a66a6 100644
--- a/runtime/doc/eval.txt
+++ b/runtime/doc/eval.txt
@@ -1554,6 +1554,12 @@
< 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 containing information about the current
+ |autocommand|. The dictionary is emptied when the |autocommand|
+ finishes, please refer to |dict-identity| for how to get an
+ independent copy of it.
+
*v:exception* *exception-variable*
v:exception The value of the exception most recently caught and not
finished. See also |v:throwpoint| and |throw-variables|.