Skip to main content

nvrim/
lib.rs

1//! Expose Rust helpers for my Nvim config to Lua via [`nvim_oxi`].
2//!
3//! Provide namespaced dictionaries for diagnostics, status UI (statusline / statuscolumn), CLI search flags,
4//! buffer text, keymaps, colorscheme & style options, test running, and misc extensions.
5//!
6//! Each top‑level key is either:
7//! - a table of related functions / data (e.g. `diagnostics`, `statusline`, `cli`)
8//! - or a standalone function / value.
9
10use ytil_noxi::Dictionary;
11
12#[macro_use]
13mod macros;
14
15/// [`nvim_oxi::api::Buffer`] helpers.
16mod buffer;
17/// CLI flags for `fd` and `ripgrep`, used by plugins.
18mod cli;
19/// User commands.
20mod cmds;
21/// Colorscheme setup.
22mod colorscheme;
23/// Diagnostics filtering / formatting / sorting.
24mod diagnostics;
25/// Core (non‑plugin) keymaps.
26pub mod keymaps;
27/// Window layout helpers.
28pub mod layout;
29/// Utilities to handle linters output
30mod linters;
31/// Custom build plugins.
32mod plugins;
33/// Style options.
34mod style_opts;
35/// `vim.opts` utilities. Avoids intra-doc links to private items for stable docs; uses plain function calls for error
36/// notifications.
37pub mod vim_opts;
38
39/// Plugin entry point.
40///
41/// Returns a namespaced [`Dictionary`] whose values are grouped
42/// sub‑dictionaries (diagnostics, UI, keymaps, plugin helpers, etc.) plus a
43/// few standalone helpers.
44#[ytil_noxi::plugin]
45fn nvrim() -> Dictionary {
46    ytil_noxi::dict! {
47        "buffer": buffer::dict(),
48        "cmds": cmds::dict(),
49        "colorscheme": colorscheme::dict(),
50        "diagnostics": diagnostics::dict(),
51        "keymaps": keymaps::dict(),
52        "linters": linters::dict(),
53        "layout": layout::dict(),
54        "plugins": plugins::dict(),
55        "style_opts": style_opts::dict(),
56        "vim_opts": vim_opts::dict(),
57    }
58}