nix-community.nixvim/plugins/by-name/mini/default.nix
github-actions[bot] 6395b9c013
flake.lock: Update
Flake lock file updates:

• Updated input 'flake-parts':
    'github:hercules-ci/flake-parts/506278e768c2a08bec68eb62932193e341f55c90?narHash=sha256-hgmguH29K2fvs9szpq2r3pz2/8cJd2LPS%2Bb4tfNFCwE%3D' (2024-11-01)
  → 'github:hercules-ci/flake-parts/205b12d8b7cd4802fbcb8e8ef6a0f1408781a4f9?narHash=sha256-4pDvzqnegAfRkPwO3wmwBhVi/Sye1mzps0zHWYnP88c%3D' (2024-12-04)
• Updated input 'git-hooks':
    'github:cachix/git-hooks.nix/3308484d1a443fc5bc92012435d79e80458fe43c?narHash=sha256-mnTbjpdqF0luOkou8ZFi2asa1N3AA2CchR/RqCNmsGE%3D' (2024-11-19)
  → 'github:cachix/git-hooks.nix/6f4e2a2112050951a314d2733a994fbab94864c6?narHash=sha256-SVQVsbafSM1dJ4fpgyBqLZ%2BLft%2BjcQuMtEL3lQWx2Sk%3D' (2024-12-04)
• Updated input 'home-manager':
    'github:nix-community/home-manager/62d536255879be574ebfe9b87c4ac194febf47c5?narHash=sha256-lYnT%2BEYE47f5yY3KS/Kd4pJ6CO9fhCqumkYYkQ3TK20%3D' (2024-12-01)
  → 'github:nix-community/home-manager/c7ffc9727d115e433fd884a62dc164b587ff651d?narHash=sha256-zjO6m5BqxXIyjrnUziAzk4%2BT4VleqjstNudSqWcpsHI%3D' (2024-12-07)
• Updated input 'nix-darwin':
    'github:lnl7/nix-darwin/c6b65d946097baf3915dd51373251de98199280d?narHash=sha256-Qs3YmoLYUJ8g4RkFj2rMrzrP91e4ShAioC9s%2BvG6ENM%3D' (2024-12-02)
  → 'github:lnl7/nix-darwin/a35b08d09efda83625bef267eb24347b446c80b8?narHash=sha256-sQJAxY1TYWD1UyibN/FnN97paTFuwBw3Vp3DNCyKsMk%3D' (2024-12-07)
• Updated input 'nixpkgs':
    'github:NixOS/nixpkgs/f9f0d5c5380be0a599b1fb54641fa99af8281539?narHash=sha256-En%2BgSoVJ3iQKPDU1FHrR6zIxSLXKjzKY%2Bpnh9tt%2BYts%3D' (2024-12-02)
  → 'github:NixOS/nixpkgs/4dc2fc4e62dbf62b84132fe526356fbac7b03541?narHash=sha256-FillH0qdWDt/nlO6ED7h4cmN%2BG9uXwGjwmCnHs0QVYM%3D' (2024-12-05)
• Updated input 'nuschtosSearch':
    'github:NuschtOS/search/16307548b7a1247291c84ae6a12c0aacb07dfba2?narHash=sha256-BC1CecAQISV5Q4LZK72Gx0%2BfaemOwaChiD9rMVfDPoA%3D' (2024-11-30)
  → 'github:NuschtOS/search/68e9fad70d95d08156cf10a030bd39487bed8ffe?narHash=sha256-315rJ7O9cOllPDaFscnJhcMleORHbxon0Kq9LAKJ5p4%3D' (2024-12-05)
• Updated input 'treefmt-nix':
    'github:numtide/treefmt-nix/6209c381904cab55796c5d7350e89681d3b2a8ef?narHash=sha256-2qbdorpq0TXHBWbVXaTqKoikN4bqAtAplTwGuII%2BoAc%3D' (2024-11-29)
  → 'github:numtide/treefmt-nix/50862ba6a8a0255b87377b9d2d4565e96f29b410?narHash=sha256-qKL3vjO%2BIXFQ0nTinFDqNq/sbbnnS5bMI1y0xX215fU%3D' (2024-12-05)
2024-12-08 05:56:53 +00:00

114 lines
4.3 KiB
Nix

{
lib,
...
}:
lib.nixvim.neovim-plugin.mkNeovimPlugin {
name = "mini";
originalName = "mini.nvim";
maintainers = [ lib.maintainers.khaneliman ];
package = "mini-nvim";
extraOptions = {
mockDevIcons = lib.mkEnableOption "mockDevIcons" // {
defaultText = lib.literalMD "`false` **NOTE**: This option is experimental and the default value may change without notice.";
description = ''
Whether to tell `mini.icons` to emulate `nvim-web-devicons` for plugins that don't natively support it.
When enabled, you don't need to set `plugins.web-devicons.enable`. This will replace the need for it.
'';
};
modules = lib.mkOption {
type = with lib.types; attrsOf (attrsOf anything);
default = { };
description = ''
Enable and configure the mini modules.
The attr name represent mini's module names, without the `"mini."` prefix.
The attr value is an attrset of options provided to the module's `setup` function.
See the [plugin documentation] for available modules to configure:
[plugin documentation]: https://github.com/echasnovski/mini.nvim?tab=readme-ov-file#modules
'';
example = {
ai = {
n_lines = 50;
search_method = "cover_or_next";
};
diff = {
view = {
style = "sign";
};
};
comment = {
mappings = {
comment = "<leader>/";
comment_line = "<leader>/";
comment_visual = "<leader>/";
textobject = "<leader>/";
};
};
surround = {
mappings = {
add = "gsa";
delete = "gsd";
find = "gsf";
find_left = "gsF";
highlight = "gsh";
replace = "gsr";
update_n_lines = "gsn";
};
};
starter = {
header = ''
'';
evaluate_single = true;
items = {
"__unkeyed-1.buildtin_actions".__raw = "require('mini.starter').sections.builtin_actions()";
"__unkeyed-2.recent_files_current_directory".__raw =
"require('mini.starter').sections.recent_files(10, false)";
"__unkeyed-3.recent_files".__raw = "require('mini.starter').sections.recent_files(10, true)";
"__unkeyed-4.sessions".__raw = "require('mini.starter').sections.sessions(5, true)";
};
content_hooks = {
"__unkeyed-1.adding_bullet".__raw = "require('mini.starter').gen_hook.adding_bullet()";
"__unkeyed-2.indexing".__raw =
"require('mini.starter').gen_hook.indexing('all', { 'Builtin actions' })";
"__unkeyed-3.padding".__raw = "require('mini.starter').gen_hook.aligning('center', 'center')";
};
};
};
};
};
# NOTE: We handle each module explicitly and not a parent settings table
callSetup = false;
hasSettings = false;
extraConfig = cfg: {
assertions = [
{
assertion = cfg.mockDevIcons -> cfg.modules ? icons;
message = ''
You have enabled `plugins.mini.mockDevIcons` but have not defined `plugins.mini.modules.icons`.
This setting will have no effect without it.
'';
}
];
plugins.mini.luaConfig.content =
lib.foldlAttrs (lines: name: config: ''
${lines}
require(${lib.nixvim.toLuaObject "mini.${name}"}).setup(${lib.nixvim.toLuaObject config})
'') "" cfg.modules
# `MiniIcons` is only in scope if we've called `require('mini.icons')` above
+ lib.optionalString ((cfg.modules ? icons) && cfg.mockDevIcons) ''
MiniIcons.mock_nvim_web_devicons()
'';
};
}