aboutsummaryrefslogtreecommitdiff
path: root/runtime
diff options
context:
space:
mode:
authorluukvbaal <luukvbaal@gmail.com>2025-02-12 11:01:06 +0100
committerGitHub <noreply@github.com>2025-02-12 11:01:06 +0100
commit82a215cb2dc2b80c1b8bc455c90a928b636d8b3a (patch)
treeb264cb2900a0bd59b3ff4976f0cf47a06cfd5f19 /runtime
parent6982106f8ca5ceaa00c9909e64cc94d2794b9143 (diff)
downloadrneovim-82a215cb2dc2b80c1b8bc455c90a928b636d8b3a.tar.gz
rneovim-82a215cb2dc2b80c1b8bc455c90a928b636d8b3a.tar.bz2
rneovim-82a215cb2dc2b80c1b8bc455c90a928b636d8b3a.zip
feat(options): add 'eventignorewin' (#32152)
vim-patch:partial: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. https://github.com/vim/vim/commit/b7147f8236c962cd74d1ce028d9106f1c449ea6c vim-patch:9.1.1102: tests: Test_WinScrolled_Resized_eiw() uses wrong filename Problem: tests: Test_WinScrolled_Resized_eiw() uses wrong filename (Luuk van Baal, after v9.1.1084) Solution: Rename the filename to something more unique https://github.com/vim/vim/commit/bfc7719e48ffc365ee0a1bd1888120d26b6365f0
Diffstat (limited to 'runtime')
-rw-r--r--runtime/doc/autocmd.txt3
-rw-r--r--runtime/doc/news.txt1
-rw-r--r--runtime/doc/options.txt7
-rw-r--r--runtime/doc/quickref.txt1
-rw-r--r--runtime/lua/vim/_meta/options.lua10
-rw-r--r--runtime/optwin.vim4
6 files changed, 25 insertions, 1 deletions
diff --git a/runtime/doc/autocmd.txt b/runtime/doc/autocmd.txt
index c094281154..a82bac5de5 100644
--- a/runtime/doc/autocmd.txt
+++ b/runtime/doc/autocmd.txt
@@ -1676,6 +1676,9 @@ To disable autocommands for some time use the 'eventignore' option. Note that
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/news.txt b/runtime/doc/news.txt
index 92492d0448..cfda05e6f5 100644
--- a/runtime/doc/news.txt
+++ b/runtime/doc/news.txt
@@ -319,6 +319,7 @@ OPTIONS
• 'completeopt' flag "preinsert" highlights text to be inserted.
• 'messagesopt' configures |:messages| and |hit-enter| prompt.
• 'tabclose' controls which tab page to focus when closing a tab page.
+• 'eventignorewin' to persistently ignore events in a window.
PERFORMANCE
diff --git a/runtime/doc/options.txt b/runtime/doc/options.txt
index 550d3cbb14..4560eff6e8 100644
--- a/runtime/doc/options.txt
+++ b/runtime/doc/options.txt
@@ -2334,6 +2334,13 @@ A jump table for the options with a short description can be found at |Q_op|.
set ei=WinEnter,WinLeave
<
+ *'eventignorewin'* *'eiw'*
+'eventignorewin' 'eiw' string (default "")
+ local to window
+ 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 f43ddb57fb..86147cfc2b 100644
--- a/runtime/doc/quickref.txt
+++ b/runtime/doc/quickref.txt
@@ -696,6 +696,7 @@ Short explanation of each option: *option-list*
'errorfile' 'ef' name of the errorfile for the QuickFix mode
'errorformat' 'efm' description of the lines in the error file
'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 init files in the current directory
'fileencoding' 'fenc' file encoding for multibyte text
diff --git a/runtime/lua/vim/_meta/options.lua b/runtime/lua/vim/_meta/options.lua
index 9bf183a1c1..cd014978b0 100644
--- a/runtime/lua/vim/_meta/options.lua
+++ b/runtime/lua/vim/_meta/options.lua
@@ -1989,6 +1989,16 @@ vim.o.ei = vim.o.eventignore
vim.go.eventignore = vim.o.eventignore
vim.go.ei = vim.go.eventignore
+--- 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'.
+---
+--- @type string
+vim.o.eventignorewin = ""
+vim.o.eiw = vim.o.eventignorewin
+vim.wo.eventignorewin = vim.o.eventignorewin
+vim.wo.eiw = vim.wo.eventignorewin
+
--- In Insert mode: Use the appropriate number of spaces to insert a
--- <Tab>. Spaces are used in indents with the '>' and '<' commands and
--- when 'autoindent' is on. To insert a real tab when 'expandtab' is
diff --git a/runtime/optwin.vim b/runtime/optwin.vim
index 6866d46d51..dff3ce39a4 100644
--- a/runtime/optwin.vim
+++ b/runtime/optwin.vim
@@ -1,7 +1,7 @@
" These commands create the option window.
"
" Maintainer: The Vim Project <https://github.com/vim/vim>
-" Last Change: 2024 Dec 07
+" Last Change: 2025 Feb 08
" Former Maintainer: Bram Moolenaar <Bram@vim.org>
" If there already is an option window, jump to that one.
@@ -1187,6 +1187,8 @@ call <SID>AddOption("virtualedit", gettext("when to use virtual editing: \"block
call <SID>OptionG("ve", &ve)
call <SID>AddOption("eventignore", gettext("list of autocommand events which are to be ignored"))
call <SID>OptionG("ei", &ei)
+call <SID>AddOption("eventignorewin", gettext("list of autocommand events which are to be ignored in a window"))
+call <SID>OptionG("eiw", &eiw)
call <SID>AddOption("loadplugins", gettext("load plugin scripts when starting up"))
call <SID>BinOptionG("lpl", &lpl)
call <SID>AddOption("exrc", gettext("enable reading .vimrc/.exrc/.gvimrc in the current directory"))