aboutsummaryrefslogtreecommitdiff
path: root/runtime/lua/vim/_extui.lua
diff options
context:
space:
mode:
authorluukvbaal <luukvbaal@gmail.com>2025-05-09 14:47:36 +0200
committerGitHub <noreply@github.com>2025-05-09 14:47:36 +0200
commit302e59f734ec4d2e032b32e0134f6925c73d1f10 (patch)
tree669aa6df82ad63328b3efc0cb8c128ffaef65b7a /runtime/lua/vim/_extui.lua
parent6adf48b66d52ba82b71af59383ef09ee9ad7e20e (diff)
downloadrneovim-302e59f734ec4d2e032b32e0134f6925c73d1f10.tar.gz
rneovim-302e59f734ec4d2e032b32e0134f6925c73d1f10.tar.bz2
rneovim-302e59f734ec4d2e032b32e0134f6925c73d1f10.zip
feat(extui): assign 'filetype' to extui windows (#33924)
Problem: Unable to discern windows used by the extui interface to configure their local options. 'winblend' may be detrimental to legibility depending on the colorscheme and 'background'. Solution: Assign the "cmdline", "msgmore", "msgprompt" and "msgbox" 'filetype' to the respective windows. Don't set 'winblend' for the message "box" window.
Diffstat (limited to 'runtime/lua/vim/_extui.lua')
-rw-r--r--runtime/lua/vim/_extui.lua23
1 files changed, 14 insertions, 9 deletions
diff --git a/runtime/lua/vim/_extui.lua b/runtime/lua/vim/_extui.lua
index 8b3f67076e..99a3dfa307 100644
--- a/runtime/lua/vim/_extui.lua
+++ b/runtime/lua/vim/_extui.lua
@@ -17,6 +17,19 @@
--- },
---})
---```
+---
+---There are four separate window types used by this interface:
+---- "cmd": The cmdline window; also used for 'showcmd', 'showmode', 'ruler', and
+--- messages if 'cmdheight' > 0.
+---- "box": The message box window; used for messages when 'cmdheight' == 0.
+---- "more": The more-prompt window; used for |:messages| and certain messages
+--- that should be shown in full.
+---- "prompt": The cmdline prompt window; used for prompt messages that expect
+--- user input.
+---
+---These four windows are assigned the "cmdline", "msgbox", "msgmore" and
+---"msgprompt" 'filetype' respectively. Use a |FileType| autocommand to configure
+---any local options for these windows and their respective buffers.
local api = vim.api
local ext = require('vim._extui.shared')
@@ -90,24 +103,17 @@ function M.enable(opts)
ext.msg.prev_msg = ''
end
ext.cmdheight = value
- elseif name == 'termguicolors' then
- -- 'termguicolors' toggled; add or remove border and set 'winblend' for box windows.
- for _, tab in ipairs(api.nvim_list_tabpages()) do
- api.nvim_win_set_config(ext.wins[tab].box, { border = value and 'none' or 'single' })
- vim.wo[ext.wins[tab].box].winblend = value and 30 or 0
- end
end
end
if vim.v.vim_did_enter == 1 then
ext.tab_check_wins()
check_opt('cmdheight', vim.o.cmdheight)
- check_opt('termguicolors', vim.o.termguicolors)
end
api.nvim_create_autocmd('OptionSet', {
group = ext.augroup,
- pattern = { 'cmdheight', 'termguicolors' },
+ pattern = { 'cmdheight' },
callback = function(ev)
ext.tab_check_wins()
check_opt(ev.match, vim.v.option_new)
@@ -122,7 +128,6 @@ function M.enable(opts)
ext.tab_check_wins()
if ev.event == 'VimEnter' then
check_opt('cmdheight', vim.o.cmdheight)
- check_opt('termguicolors', vim.o.termguicolors)
end
ext.msg.set_pos()
end,