mirror of
https://github.com/nix-community/nixvim.git
synced 2025-07-26 05:34:54 +02:00
plugins/fzf-lua: use iconsPackage
This commit is contained in:
parent
6f4eced1ca
commit
e122f465a9
2 changed files with 52 additions and 22 deletions
|
@ -2,6 +2,7 @@
|
||||||
lib,
|
lib,
|
||||||
helpers,
|
helpers,
|
||||||
config,
|
config,
|
||||||
|
options,
|
||||||
pkgs,
|
pkgs,
|
||||||
...
|
...
|
||||||
}:
|
}:
|
||||||
|
@ -47,10 +48,16 @@ helpers.neovim-plugin.mkNeovimPlugin config {
|
||||||
example = pkgs.skim;
|
example = pkgs.skim;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
# TODO: deprecated 2024-08-29 remove after 24.11
|
||||||
iconsEnabled = mkOption {
|
iconsEnabled = mkOption {
|
||||||
type = types.bool;
|
type = types.bool;
|
||||||
description = "Toggle icon support. Installs nvim-web-devicons.";
|
description = "Toggle icon support. Installs nvim-web-devicons.";
|
||||||
default = true;
|
visible = false;
|
||||||
|
};
|
||||||
|
|
||||||
|
iconsPackage = helpers.mkPackageOption {
|
||||||
|
name = "nvim-web-devicons";
|
||||||
|
default = pkgs.vimPlugins.nvim-web-devicons;
|
||||||
};
|
};
|
||||||
|
|
||||||
profile = helpers.defaultNullOpts.mkEnumFirstDefault [
|
profile = helpers.defaultNullOpts.mkEnumFirstDefault [
|
||||||
|
@ -103,28 +110,44 @@ helpers.neovim-plugin.mkNeovimPlugin config {
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
extraConfig = cfg: {
|
extraConfig =
|
||||||
extraPlugins = optional cfg.iconsEnabled pkgs.vimPlugins.nvim-web-devicons;
|
cfg:
|
||||||
|
let
|
||||||
|
opt = options.plugins.fzf-lua;
|
||||||
|
in
|
||||||
|
{
|
||||||
|
# TODO: deprecated 2024-08-29 remove after 24.11
|
||||||
|
warnings = lib.mkIf opt.iconsEnabled.isDefined [
|
||||||
|
''
|
||||||
|
nixvim (plugins.fzf-lua):
|
||||||
|
The option definition `plugins.fzf-lua.iconsEnabled' in ${showFiles opt.iconsEnabled.files} has been deprecated; please remove it.
|
||||||
|
You should use `plugins.fzf-lua.iconsPackage' instead.
|
||||||
|
''
|
||||||
|
];
|
||||||
|
|
||||||
extraPackages = optional (cfg.fzfPackage != null) cfg.fzfPackage;
|
extraPlugins = lib.mkIf (
|
||||||
|
cfg.iconsPackage != null && (opt.iconsEnabled.isDefined && cfg.iconsEnabled)
|
||||||
|
) [ cfg.iconsPackage ];
|
||||||
|
|
||||||
plugins.fzf-lua.settings.__unkeyed_profile = cfg.profile;
|
extraPackages = [ cfg.fzfPackage ];
|
||||||
|
|
||||||
keymaps = mapAttrsToList (
|
plugins.fzf-lua.settings.__unkeyed_profile = cfg.profile;
|
||||||
key: mapping:
|
|
||||||
let
|
keymaps = mapAttrsToList (
|
||||||
actionStr =
|
key: mapping:
|
||||||
if isString mapping then
|
let
|
||||||
"${mapping}()"
|
actionStr =
|
||||||
else
|
if isString mapping then
|
||||||
"${mapping.action}(${helpers.toLuaObject mapping.settings})";
|
"${mapping}()"
|
||||||
in
|
else
|
||||||
{
|
"${mapping.action}(${helpers.toLuaObject mapping.settings})";
|
||||||
inherit key;
|
in
|
||||||
mode = mapping.mode or "n";
|
{
|
||||||
action.__raw = "function() require('fzf-lua').${actionStr} end";
|
inherit key;
|
||||||
options = mapping.options or { };
|
mode = mapping.mode or "n";
|
||||||
}
|
action.__raw = "function() require('fzf-lua').${actionStr} end";
|
||||||
) cfg.keymaps;
|
options = mapping.options or { };
|
||||||
};
|
}
|
||||||
|
) cfg.keymaps;
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -54,4 +54,11 @@
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
no-packages = {
|
||||||
|
plugins.fzf-lua = {
|
||||||
|
enable = true;
|
||||||
|
iconsPackage = null;
|
||||||
|
};
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue