aboutsummaryrefslogtreecommitdiff
path: root/runtime/lua/vim
diff options
context:
space:
mode:
authorluukvbaal <luukvbaal@gmail.com>2026-04-20 02:36:55 +0200
committerGitHub <noreply@github.com>2026-04-19 20:36:55 -0400
commitfe986e5dd094b2f7e1d28e64e52ffbc5f7292191 (patch)
treeeae04471b5d12c3e419b4961c8f5405706ffb47b /runtime/lua/vim
parent5f6abd34f5c12534df0d79ee3507d40106ad505d (diff)
downloadrneovim-fe986e5dd094b2f7e1d28e64e52ffbc5f7292191.tar.gz
rneovim-fe986e5dd094b2f7e1d28e64e52ffbc5f7292191.tar.bz2
rneovim-fe986e5dd094b2f7e1d28e64e52ffbc5f7292191.zip
feat(options): add 'winpinned' to pin a window #39157
Problem: - Unable to "pin" a window to prevent closing without specifically being targeted. - :fclose closes hidden windows (even before visible windows). Solution: - Add 'winpinned' window-local option. When set, window is skipped by :fclose and :only. Pin the ui2 cmdline window (which should always be visible), so that it is not closed by :only/fclose. - Skip over hidden (and pinned) windows with :fclose. Co-authored-by: glepnir <glephunter@gmail.com>
Diffstat (limited to 'runtime/lua/vim')
-rw-r--r--runtime/lua/vim/_core/ui2.lua2
-rw-r--r--runtime/lua/vim/_meta/options.gen.lua10
2 files changed, 12 insertions, 0 deletions
diff --git a/runtime/lua/vim/_core/ui2.lua b/runtime/lua/vim/_core/ui2.lua
index 77ea7f57b3..4c7ceefda0 100644
--- a/runtime/lua/vim/_core/ui2.lua
+++ b/runtime/lua/vim/_core/ui2.lua
@@ -130,6 +130,8 @@ function M.check_targets()
hl = 'Normal:MsgArea'
elseif type == 'msg' then
hl = search_hide
+ elseif type == 'cmd' then
+ api.nvim_set_option_value('winpinned', true, { scope = 'local' })
end
api.nvim_set_option_value('winhighlight', hl, { scope = 'local' })
end)
diff --git a/runtime/lua/vim/_meta/options.gen.lua b/runtime/lua/vim/_meta/options.gen.lua
index c151c448bb..82f53eedc7 100644
--- a/runtime/lua/vim/_meta/options.gen.lua
+++ b/runtime/lua/vim/_meta/options.gen.lua
@@ -8324,6 +8324,16 @@ vim.o.wmw = vim.o.winminwidth
vim.go.winminwidth = vim.o.winminwidth
vim.go.wmw = vim.go.winminwidth
+--- If enabled, the window is pinned and will not be closed by `:only`
+--- and `:fclose`. Only commands specifically targeting the window can
+--- close it.
+---
+--- @type boolean
+vim.o.winpinned = false
+vim.o.wp = vim.o.winpinned
+vim.wo.winpinned = vim.o.winpinned
+vim.wo.wp = vim.wo.winpinned
+
--- Minimal number of columns for the current window. This is not a hard
--- minimum, Vim will use fewer columns if there is not enough room. If
--- the current window is smaller, its size is increased, at the cost of