From 13041a067ec6e0a35ae092a61a5304dc17d25f34 Mon Sep 17 00:00:00 2001 From: STG Date: Wed, 6 May 2026 21:43:01 +0900 Subject: [PATCH] fix(ui2): error E518 when typing "vim:" in cmdline #39599 Problem: `vim:`, etc. in cmdline are interpreted as modeline, causing error E518. Solution: Set 'nomodeline' when creating the buffers. (cherry picked from commit 0ea720f281985323c5f9b9cec06db8ef52fcea26) --- runtime/lua/vim/_core/ui2.lua | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/runtime/lua/vim/_core/ui2.lua b/runtime/lua/vim/_core/ui2.lua index 14211e333e..bf1192dba9 100644 --- a/runtime/lua/vim/_core/ui2.lua +++ b/runtime/lua/vim/_core/ui2.lua @@ -84,7 +84,11 @@ function M.check_targets() local win = api.nvim_win_is_valid(M.wins[type]) and M.wins[type] local floating = win and api.nvim_win_get_config(win).zindex local setopt = not buf or not win or not floating - M.bufs[type] = buf or api.nvim_create_buf(false, false) + M.bufs[type] = buf + or (function(b) + vim.bo[b].modeline = false + return b + end)(api.nvim_create_buf(false, false)) if not win or not floating then -- Open a new window when closed or no longer floating (e.g. wincmd J).