Skip to content

Commit ca94ee0

Browse files
authored
feat: add winblend option for windows (#237)
* add winblend support * change fallback value
1 parent 055b943 commit ca94ee0

File tree

6 files changed

+15
-1
lines changed

6 files changed

+15
-1
lines changed

README.md

+4-1
Original file line numberDiff line numberDiff line change
@@ -329,7 +329,7 @@ MiniDeps.add({
329329

330330
sources = {
331331
-- list of enabled providers
332-
completion = {
332+
completion = {
333333
enabled_providers = { 'lsp', 'path', 'snippets', 'buffer' },
334334
}
335335

@@ -390,6 +390,7 @@ MiniDeps.add({
390390
min_width = 15,
391391
max_height = 10,
392392
border = 'none',
393+
winblend = 0,
393394
winhighlight = 'Normal:BlinkCmpMenu,FloatBorder:BlinkCmpMenuBorder,CursorLine:BlinkCmpMenuSelection,Search:None',
394395
-- keep the cursor X lines away from the top/bottom of the window
395396
scrolloff = 2,
@@ -422,6 +423,7 @@ MiniDeps.add({
422423
max_width = 60,
423424
max_height = 20,
424425
border = 'padded',
426+
winblend = 0,
425427
winhighlight = 'Normal:BlinkCmpDoc,FloatBorder:BlinkCmpDocBorder,CursorLine:BlinkCmpDocCursorLine,Search:None',
426428
-- which directions to show the documentation window,
427429
-- for each of the possible autocomplete window directions,
@@ -440,6 +442,7 @@ MiniDeps.add({
440442
max_width = 100,
441443
max_height = 10,
442444
border = 'padded',
445+
winblend = 0,
443446
winhighlight = 'Normal:BlinkCmpSignatureHelp,FloatBorder:BlinkCmpSignatureHelpBorder',
444447

445448
-- which directions to show the window,

lua/blink/cmp/config.lua

+6
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,7 @@
116116
--- @field direction_priority? ("n" | "s")[]
117117
--- @field auto_show? boolean
118118
--- @field selection? "preselect" | "manual" | "auto_insert"
119+
--- @field winblend? number
119120
--- @field winhighlight? string
120121
--- @field scrolloff? number
121122
--- @field draw? 'simple' | 'reversed' | 'minimal' | blink.cmp.CompletionDrawFn
@@ -141,13 +142,15 @@
141142
--- @field auto_show? boolean
142143
--- @field auto_show_delay_ms? number Delay before showing the documentation window
143144
--- @field update_delay_ms? number Delay before updating the documentation window
145+
--- @field winblend? number
144146
--- @field winhighlight? string
145147

146148
--- @class blink.cmp.SignatureHelpConfig
147149
--- @field min_width? number
148150
--- @field max_width? number
149151
--- @field max_height? number
150152
--- @field border? blink.cmp.WindowBorder
153+
--- @field winblend? number
151154
--- @field winhighlight? string
152155
--- @field direction_priority? ("n" | "s")[]
153156

@@ -363,6 +366,7 @@ local config = {
363366
min_width = 15,
364367
max_height = 10,
365368
border = 'none',
369+
winblend = 0,
366370
winhighlight = 'Normal:BlinkCmpMenu,FloatBorder:BlinkCmpMenuBorder,CursorLine:BlinkCmpMenuSelection,Search:None',
367371
-- keep the cursor X lines away from the top/bottom of the window
368372
scrolloff = 2,
@@ -397,6 +401,7 @@ local config = {
397401
max_width = 80,
398402
max_height = 20,
399403
border = 'padded',
404+
winblend = 0,
400405
winhighlight = 'Normal:BlinkCmpDoc,FloatBorder:BlinkCmpDocBorder,CursorLine:BlinkCmpDocCursorLine,Search:None',
401406
-- which directions to show the documentation window,
402407
-- for each of the possible autocomplete window directions,
@@ -415,6 +420,7 @@ local config = {
415420
max_width = 100,
416421
max_height = 10,
417422
border = 'padded',
423+
winblend = 0,
418424
winhighlight = 'Normal:BlinkCmpSignatureHelp,FloatBorder:BlinkCmpSignatureHelpBorder',
419425

420426
-- which directions to show the window,

lua/blink/cmp/windows/autocomplete.lua

+1
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ function autocomplete.setup()
7777
min_width = autocmp_config.min_width,
7878
max_height = autocmp_config.max_height,
7979
border = autocmp_config.border,
80+
winblend = autocmp_config.winblend,
8081
winhighlight = autocmp_config.winhighlight,
8182
cursorline = false,
8283
scrolloff = autocmp_config.scrolloff,

lua/blink/cmp/windows/documentation.lua

+1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ function docs.setup()
1010
max_width = config.max_width,
1111
max_height = config.max_height,
1212
border = config.border,
13+
winblend = config.winblend,
1314
winhighlight = config.winhighlight,
1415
wrap = true,
1516
filetype = 'markdown',

lua/blink/cmp/windows/lib/init.lua

+2
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ function win.new(config)
4949
border = config.border or 'none',
5050
wrap = config.wrap or false,
5151
filetype = config.filetype or 'cmp_menu',
52+
winblend = config.winblend or 0,
5253
winhighlight = config.winhighlight or 'Normal:NormalFloat,FloatBorder:NormalFloat',
5354
scrolloff = config.scrolloff or 0,
5455
}
@@ -90,6 +91,7 @@ function win:open()
9091
zindex = 1001,
9192
border = self.config.border == 'padded' and { ' ', '', '', ' ', '', '', ' ', ' ' } or self.config.border,
9293
})
94+
vim.api.nvim_set_option_value('winblend', self.config.winblend, { win = self.id })
9395
vim.api.nvim_set_option_value('winhighlight', self.config.winhighlight, { win = self.id })
9496
vim.api.nvim_set_option_value('wrap', self.config.wrap, { win = self.id })
9597
vim.api.nvim_set_option_value('foldenable', false, { win = self.id })

lua/blink/cmp/windows/signature.lua

+1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ function signature.setup()
99
max_width = config.max_width,
1010
max_height = config.max_height,
1111
border = config.border,
12+
winblend = config.winblend,
1213
winhighlight = config.winhighlight,
1314
wrap = true,
1415
filetype = 'markdown',

0 commit comments

Comments
 (0)