From 12c3e59e6aaab1a23b8255c4a02d1d8a6bd8a6e1 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Fri, 21 Aug 2026 09:25:40 +0800 Subject: [PATCH] vim-patch:76f1eed: runtime(doc): clarify how setbufvar() handles window options (#41408) related: vim/vim#21089 closes: vim/vim#21104 https://github.com/vim/vim/commit/76f1eed3a5f8fe12a7b01725a99c582a95e69000 Co-authored-by: Hirohito Higashi --- runtime/doc/vimfn.txt | 7 +++++-- runtime/lua/vim/_meta/vimfn.gen.lua | 7 +++++-- src/nvim/eval.lua | 7 +++++-- 3 files changed, 15 insertions(+), 6 deletions(-) diff --git a/runtime/doc/vimfn.txt b/runtime/doc/vimfn.txt index 837a185666..26668fbb6e 100644 --- a/runtime/doc/vimfn.txt +++ b/runtime/doc/vimfn.txt @@ -9356,8 +9356,11 @@ setbufvar({buf}, {varname}, {val}) *setbufvar()* Set option or local variable {varname} (string, without "b:") in buffer {buf} to {val}. Also works for a global or - window-local option (not variable). When targeting - a window-local option, the global option is unchanged. + window-local option (not variable). A window-local option is + set in a window of the current tabpage that displays {buf}, + and the global value is unchanged. When no window in the + current tabpage displays {buf} the option is not set and no + error is given; use |setwinvar()| or |win_execute()| for that. For the use of {buf}, see |bufname()| above. diff --git a/runtime/lua/vim/_meta/vimfn.gen.lua b/runtime/lua/vim/_meta/vimfn.gen.lua index c29036279c..b42f17f9c7 100644 --- a/runtime/lua/vim/_meta/vimfn.gen.lua +++ b/runtime/lua/vim/_meta/vimfn.gen.lua @@ -8414,8 +8414,11 @@ function vim.fn.setbufline(buf, lnum, text) end --- --- Set option or local variable {varname} (string, without "b:") --- in buffer {buf} to {val}. Also works for a global or ---- window-local option (not variable). When targeting ---- a window-local option, the global option is unchanged. +--- window-local option (not variable). A window-local option is +--- set in a window of the current tabpage that displays {buf}, +--- and the global value is unchanged. When no window in the +--- current tabpage displays {buf} the option is not set and no +--- error is given; use |setwinvar()| or |win_execute()| for that. --- --- For the use of {buf}, see |bufname()| above. --- diff --git a/src/nvim/eval.lua b/src/nvim/eval.lua index fb9a43f95a..f8d92119f5 100644 --- a/src/nvim/eval.lua +++ b/src/nvim/eval.lua @@ -10090,8 +10090,11 @@ M.funcs = { desc = [=[ Set option or local variable {varname} (string, without "b:") in buffer {buf} to {val}. Also works for a global or - window-local option (not variable). When targeting - a window-local option, the global option is unchanged. + window-local option (not variable). A window-local option is + set in a window of the current tabpage that displays {buf}, + and the global value is unchanged. When no window in the + current tabpage displays {buf} the option is not set and no + error is given; use |setwinvar()| or |win_execute()| for that. For the use of {buf}, see |bufname()| above.