64 lines
2.1 KiB
Lua
64 lines
2.1 KiB
Lua
vim.pack.add({
|
|
{ src = "https://github.com/gelguy/wilder.nvim" },
|
|
{ src = "https://github.com/nvim-tree/nvim-web-devicons" },
|
|
})
|
|
|
|
local wilder = require("wilder")
|
|
|
|
-- Suggestions while typing in cmdline and search modes.
|
|
-- <Tab>/<S-Tab> cycle candidates, <Down> accepts.
|
|
wilder.setup({ modes = { ":", "/", "?" } })
|
|
|
|
-- Catppuccin palette
|
|
local blue = "#89b4fa"
|
|
local overlay0 = "#9399b3"
|
|
local surface0 = "#313244"
|
|
local mantle = "#181826"
|
|
local text = "#cdd6f4"
|
|
|
|
-- Derive wilder highlight groups from the catppuccin colors above. Groups
|
|
-- made with make_hl are recreated each time wilder starts, so they track
|
|
-- values computed at colorscheme load time.
|
|
local function hl(name, base, fg, bg)
|
|
return wilder.make_hl(name, base, { { a = 1 }, { a = 1 }, {
|
|
foreground = fg,
|
|
background = bg,
|
|
} })
|
|
end
|
|
|
|
local menu_hl = hl("WilderCatppuccinMenu", "Pmenu", overlay0, mantle)
|
|
local selected_hl = hl("WilderCatppuccinMenuSel", "PmenuSel", text, surface0)
|
|
local accent_hl = hl("WilderCatppuccinAccent", "Pmenu", blue, mantle)
|
|
local sel_accent_hl = hl("WilderCatppuccinSelAccent", "PmenuSel", blue, surface0)
|
|
local border_hl = hl("WilderCatppuccinBorder", "FloatBorder", blue, mantle)
|
|
|
|
-- popupmenu fits the cmdline better; wildmenu avoids overlapping the
|
|
-- window when searching with / or ?
|
|
wilder.set_option("renderer", wilder.renderer_mux({
|
|
[":"] = wilder.popupmenu_renderer(
|
|
wilder.popupmenu_border_theme({
|
|
highlighter = wilder.basic_highlighter(),
|
|
highlights = {
|
|
default = menu_hl,
|
|
selected = selected_hl,
|
|
accent = accent_hl,
|
|
selected_accent = sel_accent_hl,
|
|
border = border_hl,
|
|
},
|
|
left = { " ", wilder.popupmenu_devicons() }, -- file icons for file candidates
|
|
right = { " ", wilder.popupmenu_scrollbar() },
|
|
border = "rounded",
|
|
min_height = 3, -- keep the bordered popup a consistent size
|
|
})
|
|
),
|
|
["/"] = wilder.wildmenu_renderer({
|
|
highlighter = wilder.basic_highlighter(),
|
|
highlights = {
|
|
default = menu_hl,
|
|
selected = selected_hl,
|
|
accent = accent_hl,
|
|
selected_accent = sel_accent_hl,
|
|
},
|
|
}),
|
|
}))
|