mirror of
https://github.com/folke/snacks.nvim
synced 2025-12-23 08:47:57 +00:00
2 KiB
2 KiB
🍿 util
📚 Types
---@alias snacks.util.hl table<string, string|vim.api.keyset.highlight>
📦 Module
Snacks.util.blend()
---@param fg string foreground color
---@param bg string background color
---@param alpha number number between 0 and 1. 0 results in bg, 1 results in fg
Snacks.util.blend(fg, bg, alpha)
Snacks.util.bo()
Set buffer-local options.
---@param buf number
---@param bo vim.bo
Snacks.util.bo(buf, bo)
Snacks.util.color()
---@param group string hl group to get color from
---@param prop? string property to get. Defaults to "fg"
Snacks.util.color(group, prop)
Snacks.util.file_decode()
Decodes a file name to a string.
---@param str string
Snacks.util.file_decode(str)
Snacks.util.file_encode()
Encodes a string to be used as a file name.
---@param str string
Snacks.util.file_encode(str)
Snacks.util.icon()
Get an icon from mini.icons or nvim-web-devicons.
---@param name string
---@param cat? string defaults to "file"
---@return string, string?
Snacks.util.icon(name, cat)
Snacks.util.is_transparent()
Check if the colorscheme is transparent.
Snacks.util.is_transparent()
Snacks.util.redraw()
Redraw the window. Optimized for Neovim >= 0.10
---@param win number
Snacks.util.redraw(win)
Snacks.util.redraw_range()
Redraw the range of lines in the window. Optimized for Neovim >= 0.10
---@param win number
---@param from number -- 1-indexed, inclusive
---@param to number -- 1-indexed, inclusive
Snacks.util.redraw_range(win, from, to)
Snacks.util.set_hl()
Ensures the hl groups are always set, even after a colorscheme change.
---@param groups snacks.util.hl
---@param opts? { prefix?:string, default?:boolean, managed?:boolean }
Snacks.util.set_hl(groups, opts)
Snacks.util.wo()
Set window-local options.
---@param win number
---@param wo vim.wo
Snacks.util.wo(win, wo)