Skip to content

Commit 1a9cb7a

Browse files
0xJWLabsSaghen
authored andcommitted
feat: introduce customizable winhighlight for autocomplete and documentation windows
- Added `winhighlight` support to enable user-defined highlight customization for both autocomplete and documentation windows. - Enhances user control over window appearance for a more personalized interface.
1 parent 8302613 commit 1a9cb7a

File tree

3 files changed

+9
-5
lines changed

3 files changed

+9
-5
lines changed

lua/blink/cmp/config.lua

+2
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@
8282
--- @field order "top_down" | "bottom_up"
8383
--- @field direction_priority ("n" | "s")[]
8484
--- @field preselect boolean
85+
--- @field winhighlight string | nil
8586

8687
--- @class blink.cmp.DocumentationDirectionPriorityConfig
8788
--- @field autocomplete_north ("n" | "s" | "e" | "w")[]
@@ -98,6 +99,7 @@
9899
--- @field auto_show boolean
99100
--- @field auto_show_delay_ms number Delay before showing the documentation window
100101
--- @field update_delay_ms number Delay before updating the documentation window
102+
--- @field winhighlight string | nil
101103

102104
--- @class blink.cmp.SignatureHelpConfig
103105
--- @field min_width number

lua/blink/cmp/windows/autocomplete.lua

+6-5
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
-- todo: track cursor position
22
local config = require('blink.cmp.config')
3+
local autocmp_config = config.windows.autocomplete
34
local autocomplete = {
45
items = {},
56
context = nil,
@@ -12,12 +13,12 @@ local autocomplete = {
1213

1314
function autocomplete.setup()
1415
autocomplete.win = require('blink.cmp.windows.lib').new({
15-
min_width = config.min_width,
16-
max_width = config.max_width,
17-
max_height = config.max_height,
18-
border = config.border,
16+
min_width = autocmp_config.min_width,
17+
max_width = autocmp_config.max_width,
18+
max_height = autocmp_config.max_height,
19+
border = autocmp_config.border,
1920
cursorline = true,
20-
winhighlight = 'Normal:Pmenu,FloatBorder:Pmenu,CursorLine:PmenuSel,Search:None',
21+
winhighlight = autocmp_config.winhighlight or 'Normal:Pmenu,FloatBorder:Pmenu,CursorLine:PmenuSel,Search:None',
2122
scrolloff = 2,
2223
})
2324

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+
winhighlight = config.winhighlight or 'Normal:Normal,FloatBorder:FloatBorder,CursorLine:Visual,Search:None',
1314
wrap = true,
1415
filetype = 'markdown',
1516
})

0 commit comments

Comments
 (0)