improve(prompt_input): support to customize the border and body highlight (#1846)

This commit is contained in:
guanghechen
2025-04-11 10:20:40 +08:00
committed by GitHub
parent f97352e95d
commit c74ef1b9bc
3 changed files with 9 additions and 1 deletions

View File

@@ -722,6 +722,8 @@ return {
| AvanteConflictIncomingLabel | Incoming conflict label highlight | Default to shade of `AvanteConflictIncoming` |
| AvantePopupHint | Usage hints in popup menus | |
| AvanteInlineHint | The end-of-line hint displayed in visual mode | |
| AvantePromptInput | The body highlight of the prompt input | |
| AvantePromptInputBorder | The border highlight of the prompt input | Default to `NormalFloat` |
See [highlights.lua](./lua/avante/highlights.lua) for more information

View File

@@ -25,6 +25,8 @@ local Highlights = {
BUTTON_PRIMARY_HOVER = { name = "AvanteButtonPrimaryHover", fg = "#1e222a", bg = "#56b6c2" },
BUTTON_DANGER = { name = "AvanteButtonDanger", fg = "#1e222a", bg = "#ABB2BF" },
BUTTON_DANGER_HOVER = { name = "AvanteButtonDangerHover", fg = "#1e222a", bg = "#e06c75" },
AVANTE_PROMPT_INPUT = { name = "AvantePromptInput" },
AVANTE_PROMPT_INPUT_BORDER = { name = "AvantePromptInputBorder", link = "NormalFloat" },
AVANTE_SIDEBAR_WIN_SEPARATOR = {
name = "AvanteSidebarWinSeparator",
fg_link_bg = "NormalFloat",

View File

@@ -117,7 +117,11 @@ function PromptInput:open()
api.nvim_set_option_value("wrap", false, { win = winid })
api.nvim_set_option_value("winblend", 5, { win = winid })
api.nvim_set_option_value("winhighlight", "FloatBorder:NormalFloat", { win = winid })
api.nvim_set_option_value(
"winhighlight",
"FloatBorder:AvantePromptInputBorder,Normal:AvantePromptInput",
{ win = winid }
)
api.nvim_set_option_value("cursorline", true, { win = winid })
api.nvim_set_option_value("modifiable", true, { buf = bufnr })