patch 9.1.1084: Unable to persistently ignore events in a window and its buffers
Problem: Unable to persistently ignore events in a window and its buffers.
Solution: Add 'eventignorewin' option to ignore events in a window and buffer
(Luuk van Baal)
Add the window-local 'eventignorewin' option that is analogous to
'eventignore', but applies to a certain window and its buffers. Identify
events that should be allowed in 'eventignorewin', adapt "auto_event"
and "event_tab" to encode this information. Window context is not passed
onto apply_autocmds_group(), and when to ignore an event is a bit
ambiguous when "buf" is not "curbuf", rather than a large refactor, only
ignore an event when all windows into "buf" are ignoring the event.
closes: #16530
Signed-off-by: Luuk van Baal <luukvbaal@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
diff --git a/runtime/doc/autocmd.txt b/runtime/doc/autocmd.txt
index 8a653f2..a8f1b8b 100644
--- a/runtime/doc/autocmd.txt
+++ b/runtime/doc/autocmd.txt
@@ -1,4 +1,4 @@
-*autocmd.txt* For Vim version 9.1. Last change: 2024 Dec 04
+*autocmd.txt* For Vim version 9.1. Last change: 2025 Feb 08
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -1992,6 +1992,9 @@
this may cause unexpected behavior, make sure you restore 'eventignore'
afterwards, using a |:try| block with |:finally|.
+To disable autocmds indefinitely in a specific window use the 'eventignorewin'
+option. This can only be used to ignore window and buffer related events.
+
*:noautocmd* *:noa*
To disable autocommands for just one command use the ":noautocmd" command
modifier. This will set 'eventignore' to "all" for the duration of the
diff --git a/runtime/doc/options.txt b/runtime/doc/options.txt
index 22ea421..94fb739 100644
--- a/runtime/doc/options.txt
+++ b/runtime/doc/options.txt
@@ -1,4 +1,4 @@
-*options.txt* For Vim version 9.1. Last change: 2025 Feb 01
+*options.txt* For Vim version 9.1. Last change: 2025 Feb 08
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -3283,6 +3283,13 @@
Otherwise this is a comma-separated list of event names. Example: >
:set ei=WinEnter,WinLeave
<
+ *'eventignorewin'* *'eiw'*
+'eventignorewin' 'eiw' string (default "")
+ window-local
+ Similar to 'eventignore' but applies to a particular window and its
+ buffers, for which window and buffer related autocommands can be
+ ignored indefinitely without affecting the global 'eventignore'.
+
*'expandtab'* *'et'* *'noexpandtab'* *'noet'*
'expandtab' 'et' boolean (default off)
local to buffer
diff --git a/runtime/doc/quickref.txt b/runtime/doc/quickref.txt
index a43d28f..87764a2 100644
--- a/runtime/doc/quickref.txt
+++ b/runtime/doc/quickref.txt
@@ -1,4 +1,4 @@
-*quickref.txt* For Vim version 9.1. Last change: 2024 Nov 02
+*quickref.txt* For Vim version 9.1. Last change: 2025 Feb 08
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -698,6 +698,7 @@
'errorformat' 'efm' description of the lines in the error file
'esckeys' 'ek' recognize function keys in Insert mode
'eventignore' 'ei' autocommand events that are ignored
+'eventignorewin' 'eiw' autocommand events that are ignored in a window
'expandtab' 'et' use spaces when <Tab> is inserted
'exrc' 'ex' read .vimrc and .exrc in the current directory
'fileencoding' 'fenc' file encoding for multibyte text
diff --git a/runtime/doc/tags b/runtime/doc/tags
index 7acca38..eb9c48c 100644
--- a/runtime/doc/tags
+++ b/runtime/doc/tags
@@ -230,6 +230,7 @@
'ef' options.txt /*'ef'*
'efm' options.txt /*'efm'*
'ei' options.txt /*'ei'*
+'eiw' options.txt /*'eiw'*
'ek' options.txt /*'ek'*
'emo' options.txt /*'emo'*
'emoji' options.txt /*'emoji'*
@@ -248,6 +249,7 @@
'esckeys' options.txt /*'esckeys'*
'et' options.txt /*'et'*
'eventignore' options.txt /*'eventignore'*
+'eventignorewin' options.txt /*'eventignorewin'*
'ex' options.txt /*'ex'*
'expandtab' options.txt /*'expandtab'*
'exrc' options.txt /*'exrc'*
diff --git a/runtime/doc/version9.txt b/runtime/doc/version9.txt
index 68287d3..43c5cfe 100644
--- a/runtime/doc/version9.txt
+++ b/runtime/doc/version9.txt
@@ -1,4 +1,4 @@
-*version9.txt* For Vim version 9.1. Last change: 2025 Feb 01
+*version9.txt* For Vim version 9.1. Last change: 2025 Feb 08
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -41696,6 +41696,7 @@
'completeitemalign' Order of |complete-items| in Insert mode completion
popup
+'eventignorewin' autocommand events that are ignored in a window
'findfunc' Vim function to obtain the results for a |:find|
command
'messagesopt' configure |:messages| and |hit-enter| prompt