diff options
| author | luukvbaal <luukvbaal@gmail.com> | 2025-05-09 14:47:36 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-05-09 14:47:36 +0200 |
| commit | 302e59f734ec4d2e032b32e0134f6925c73d1f10 (patch) | |
| tree | 669aa6df82ad63328b3efc0cb8c128ffaef65b7a /runtime/lua/vim/_extui/shared.lua | |
| parent | 6adf48b66d52ba82b71af59383ef09ee9ad7e20e (diff) | |
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/shared.lua')
| -rw-r--r-- | runtime/lua/vim/_extui/shared.lua | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/runtime/lua/vim/_extui/shared.lua b/runtime/lua/vim/_extui/shared.lua index 5c0910849e..76eb744135 100644 --- a/runtime/lua/vim/_extui/shared.lua +++ b/runtime/lua/vim/_extui/shared.lua @@ -47,7 +47,7 @@ function M.tab_check_wins() M.cmd.highlighter = vim.treesitter.highlighter.new(parser) elseif type == 'more' then -- Close more window with `q`, same as `checkhealth` - vim.keymap.set('n', 'q', '<C-w>c', { buffer = M.bufs.more }) + api.nvim_buf_set_keymap(M.bufs.more, 'n', 'q', '<C-w>c', {}) end end @@ -80,12 +80,15 @@ function M.tab_check_wins() end if setopt then - if type == 'box' and o.termguicolors then - vim.wo[M.wins[M.tab][type]].winblend = 30 - end - vim.wo[M.wins[M.tab][type]].linebreak = false - vim.wo[M.wins[M.tab][type]].smoothscroll = true - vim.wo[M.wins[M.tab][type]].eventignorewin = 'all' + -- Fire a FileType autocommand with window context to let the user reconfigure local options. + api.nvim_win_call(M.wins[M.tab][type], function() + api.nvim_set_option_value('wrap', true, { scope = 'local' }) + api.nvim_set_option_value('linebreak', false, { scope = 'local' }) + api.nvim_set_option_value('smoothscroll', true, { scope = 'local' }) + local ft = type == 'cmd' and 'cmdline' or ('msg' .. type) + api.nvim_set_option_value('filetype', ft, { scope = 'local' }) + api.nvim_set_option_value('eventignorewin', 'all', { scope = 'local' }) + end) end end end |
