nvrim/style_opts.rs
1//! UI style options exposed as dictionaries for Lua consumption.
2//!
3//! Provides helper functions returning [`nvim_oxi::Dictionary`] values with
4//! editor UI style configuration (window borders, previewer behavior, etc.).
5
6use nvim_oxi::Dictionary;
7
8/// UI style options exported as an Nvim [`Dictionary`].
9pub fn dict() -> Dictionary {
10 dict! {
11 "window": dict! {
12 "border": "rounded",
13 },
14 "fzf_lua": fn_from!(fzf_lua),
15 }
16}
17
18/// Returns the desired default `fzf-lua` previewer configuration as a [`Dictionary`].
19fn fzf_lua(previewer_kind: Option<String>) -> Dictionary {
20 dict! {
21 "previewer": previewer_kind.unwrap_or_else(|| "builtin".to_string()),
22 "winopts": dict! {
23 "title": "",
24 "height": 1,
25 "preview": dict! {
26 "default": "builtin",
27 "layout": "vertical",
28 "vertical": "down:60%",
29 }
30 }
31 }
32}