diff options
| author | Willaaaaaaa <1091220123@qq.com> | 2026-03-12 02:16:35 +0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-03-11 14:16:35 -0400 |
| commit | 689a149b089095a29ef2fcfbf31137a230f28d07 (patch) | |
| tree | ff4f8bb871056ddbda1e5e329b6195fa6947f47e /runtime/lua/vim/_meta/options.lua | |
| parent | f168d215cfa2372c71e231f457b62b255f00a6e2 (diff) | |
fix(prompt): don't implicitly set 'modified' #38118
Problem:
In aec3d7915c55fc0b7dc73f6186cf0ae45d416d33 Vim changed prompt-buffers
to respect 'modified' so the termdebug plugin can "control closing the
window". But for most use-cases (REPL, shell, AI "chat", …),
prompt-buffers are in practice always "modified", and no way to "save"
them, so *implicitly* setting 'modified' is noisy and annoying.
Solution:
Don't implicitly set 'modified' when a prompt-buffer is updated.
Plugins/users can still explicitly set 'modified', which will then
trigger the "E37: No write since last change" warning.
Diffstat (limited to 'runtime/lua/vim/_meta/options.lua')
| -rw-r--r-- | runtime/lua/vim/_meta/options.lua | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/runtime/lua/vim/_meta/options.lua b/runtime/lua/vim/_meta/options.lua index 4b532cf34e..2ae4fbc7ec 100644 --- a/runtime/lua/vim/_meta/options.lua +++ b/runtime/lua/vim/_meta/options.lua @@ -4565,8 +4565,11 @@ vim.bo.ma = vim.bo.modifiable --- result of a BufNewFile, BufRead/BufReadPost, BufWritePost, --- FileAppendPost or VimLeave autocommand event. See `gzip-example` for --- an explanation. ---- When 'buftype' is "nowrite" or "nofile" this option may be set, but ---- will be ignored. +--- When 'buftype' is "nowrite" or "nofile", this option may be set, but +--- it is ignored and will not block closing the window. For "prompt" +--- buffers, changes made to the buffer do not make it count as modified, +--- but an explicit ":set modified" is respected and will block closing the +--- window. --- Note that the text may actually be the same, e.g. 'modified' is set --- when using "rA" on an "A". --- |
