feat: make winblend configurable (#1861)

This commit is contained in:
Yi Ming
2024-03-24 19:44:34 +08:00
committed by GitHub
parent c34fa793ea
commit 97dc716fc9
5 changed files with 11 additions and 2 deletions

View File

@@ -696,6 +696,12 @@ window.{completion,documentation}.border~
window.{completion,documentation}.winhighlight~ window.{completion,documentation}.winhighlight~
`string | cmp.WinhighlightConfig` `string | cmp.WinhighlightConfig`
Specify the window's winhighlight option. Specify the window's winhighlight option.
See |nvim_open_win|.
*cmp-config.window.{completion,documentation}.winblend*
window.{completion,documentation}.winblend~
`string | cmp.WinhighlightConfig`
Specify the window's winblend option.
See |nvim_open_win|. See |nvim_open_win|.
*cmp-config.window.{completion,documentation}.zindex* *cmp-config.window.{completion,documentation}.zindex*

View File

@@ -107,6 +107,7 @@ return function()
completion = { completion = {
border = { '', '', '', '', '', '', '', '' }, border = { '', '', '', '', '', '', '', '' },
winhighlight = 'Normal:Pmenu,FloatBorder:Pmenu,CursorLine:PmenuSel,Search:None', winhighlight = 'Normal:Pmenu,FloatBorder:Pmenu,CursorLine:PmenuSel,Search:None',
winblend = vim.o.pumblend,
scrolloff = 0, scrolloff = 0,
col_offset = 0, col_offset = 0,
side_padding = 1, side_padding = 1,
@@ -117,6 +118,7 @@ return function()
max_width = math.floor((WIDE_HEIGHT * 2) * (vim.o.columns / (WIDE_HEIGHT * 2 * 16 / 9))), max_width = math.floor((WIDE_HEIGHT * 2) * (vim.o.columns / (WIDE_HEIGHT * 2 * 16 / 9))),
border = { '', '', '', ' ', '', '', '', ' ' }, border = { '', '', '', ' ', '', '', '', ' ' },
winhighlight = 'FloatBorder:NormalFloat', winhighlight = 'FloatBorder:NormalFloat',
winblend = vim.o.pumblend,
}, },
}, },
} }

View File

@@ -121,6 +121,7 @@ cmp.ItemField = {
---@class cmp.WindowOptions ---@class cmp.WindowOptions
---@field public border? string|string[] ---@field public border? string|string[]
---@field public winhighlight? string ---@field public winhighlight? string
---@field public winblend? number
---@field public zindex? integer|nil ---@field public zindex? integer|nil
---@class cmp.CompletionWindowOptions: cmp.WindowOptions ---@class cmp.CompletionWindowOptions: cmp.WindowOptions

View File

@@ -201,7 +201,7 @@ custom_entries_view.open = function(self, offset, entries)
end end
-- Apply window options (that might be changed) on the custom completion menu. -- Apply window options (that might be changed) on the custom completion menu.
self.entries_win:option('winblend', vim.o.pumblend) self.entries_win:option('winblend', completion.winblend)
self.entries_win:option('winhighlight', completion.winhighlight) self.entries_win:option('winhighlight', completion.winhighlight)
self.entries_win:option('scrolloff', completion.scrolloff) self.entries_win:option('scrolloff', completion.scrolloff)
self.entries_win:open({ self.entries_win:open({

View File

@@ -100,7 +100,7 @@ docs_view.open = function(self, e, view)
end end
-- Render window. -- Render window.
self.window:option('winblend', vim.o.pumblend) self.window:option('winblend', documentation.winblend)
self.window:option('winhighlight', documentation.winhighlight) self.window:option('winhighlight', documentation.winhighlight)
local style = { local style = {
relative = 'editor', relative = 'editor',