2023-12-08 16:34:34 +07:00
|
|
|
|
{
|
2024-09-20 12:50:26 -05:00
|
|
|
|
config,
|
2023-12-08 16:34:34 +07:00
|
|
|
|
lib,
|
|
|
|
|
helpers,
|
|
|
|
|
...
|
|
|
|
|
}:
|
|
|
|
|
with lib;
|
|
|
|
|
let
|
|
|
|
|
settingsOptions = {
|
|
|
|
|
fzf_bin = helpers.mkNullOrStr ''
|
|
|
|
|
The path to the `fzf` binary to use.
|
|
|
|
|
|
|
|
|
|
Example: `"skim"`
|
|
|
|
|
'';
|
|
|
|
|
};
|
|
|
|
|
settingsExample = {
|
|
|
|
|
winopts = {
|
|
|
|
|
height = 0.4;
|
|
|
|
|
width = 0.93;
|
|
|
|
|
row = 0.99;
|
|
|
|
|
col = 0.3;
|
|
|
|
|
};
|
|
|
|
|
files = {
|
|
|
|
|
find_opts.__raw = "[[-type f -not -path '*.git/objects*' -not -path '*.env*']]";
|
|
|
|
|
prompt = "Files❯ ";
|
|
|
|
|
multiprocess = true;
|
|
|
|
|
file_icons = true;
|
|
|
|
|
color_icons = true;
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
in
|
2024-12-22 09:58:27 +00:00
|
|
|
|
lib.nixvim.plugins.mkNeovimPlugin {
|
2023-12-08 16:34:34 +07:00
|
|
|
|
name = "fzf-lua";
|
|
|
|
|
|
|
|
|
|
maintainers = [ maintainers.GaetanLepage ];
|
|
|
|
|
|
|
|
|
|
inherit settingsOptions settingsExample;
|
|
|
|
|
|
2025-04-27 09:53:12 +02:00
|
|
|
|
dependencies = [ "fzf" ];
|
|
|
|
|
|
2025-04-07 22:50:16 +02:00
|
|
|
|
imports = [
|
|
|
|
|
# TODO: added 2025-04-07, remove after 25.05
|
|
|
|
|
(lib.nixvim.mkRemovedPackageOptionModule {
|
|
|
|
|
plugin = "fzf-lua";
|
|
|
|
|
packageName = "fzf";
|
|
|
|
|
})
|
|
|
|
|
];
|
2023-12-08 16:34:34 +07:00
|
|
|
|
|
2025-04-07 22:50:16 +02:00
|
|
|
|
extraOptions = {
|
2024-08-29 09:41:26 -05:00
|
|
|
|
# TODO: deprecated 2024-08-29 remove after 24.11
|
2023-12-08 16:34:34 +07:00
|
|
|
|
iconsEnabled = mkOption {
|
|
|
|
|
type = types.bool;
|
|
|
|
|
description = "Toggle icon support. Installs nvim-web-devicons.";
|
2024-08-29 09:41:26 -05:00
|
|
|
|
visible = false;
|
|
|
|
|
};
|
|
|
|
|
|
2023-12-08 16:34:34 +07:00
|
|
|
|
profile = helpers.defaultNullOpts.mkEnumFirstDefault [
|
|
|
|
|
"default"
|
|
|
|
|
"fzf-native"
|
|
|
|
|
"fzf-tmux"
|
|
|
|
|
"fzf-vim"
|
|
|
|
|
"max-perf"
|
|
|
|
|
"telescope"
|
|
|
|
|
"skim"
|
|
|
|
|
] "Preconfigured profile to use";
|
|
|
|
|
|
|
|
|
|
keymaps = mkOption {
|
|
|
|
|
type =
|
|
|
|
|
with types;
|
|
|
|
|
attrsOf (
|
|
|
|
|
either str (submodule {
|
|
|
|
|
options = {
|
|
|
|
|
action = mkOption {
|
|
|
|
|
type = types.str;
|
|
|
|
|
description = "The `fzf-lua` action to run";
|
|
|
|
|
example = "git_files";
|
2024-05-05 19:39:35 +02:00
|
|
|
|
};
|
2023-12-08 16:34:34 +07:00
|
|
|
|
settings = helpers.mkSettingsOption {
|
|
|
|
|
options = settingsOptions;
|
|
|
|
|
description = "`fzf-lua` settings for this command.";
|
|
|
|
|
example = settingsExample;
|
2024-05-05 19:39:35 +02:00
|
|
|
|
};
|
2023-12-08 16:34:34 +07:00
|
|
|
|
mode = helpers.keymaps.mkModeOption "n";
|
|
|
|
|
options = helpers.keymaps.mapConfigOptions;
|
|
|
|
|
};
|
2024-05-05 19:39:35 +02:00
|
|
|
|
})
|
|
|
|
|
);
|
2023-12-08 16:34:34 +07:00
|
|
|
|
description = "Keymaps for Fzf-Lua.";
|
|
|
|
|
default = { };
|
2025-01-24 22:17:49 +00:00
|
|
|
|
example = lib.literalExpression ''
|
|
|
|
|
{
|
|
|
|
|
"<leader>fg" = "live_grep";
|
|
|
|
|
"<C-p>" = {
|
|
|
|
|
action = "git_files";
|
|
|
|
|
settings = {
|
|
|
|
|
previewers.cat.cmd = lib.getExe' pkgs.coreutils "cat";
|
|
|
|
|
winopts.height = 0.5;
|
|
|
|
|
};
|
|
|
|
|
options = {
|
|
|
|
|
silent = true;
|
|
|
|
|
desc = "Fzf-Lua Git Files";
|
|
|
|
|
};
|
2023-12-08 16:34:34 +07:00
|
|
|
|
};
|
|
|
|
|
};
|
2025-01-24 22:17:49 +00:00
|
|
|
|
'';
|
2023-12-08 16:34:34 +07:00
|
|
|
|
};
|
2024-05-05 19:39:35 +02:00
|
|
|
|
};
|
2023-12-08 16:34:34 +07:00
|
|
|
|
|
2024-11-19 15:47:49 +00:00
|
|
|
|
extraConfig = cfg: opts: {
|
|
|
|
|
# TODO: deprecated 2024-08-29 remove after 24.11
|
2025-01-29 14:16:00 +01:00
|
|
|
|
warnings = lib.nixvim.mkWarnings "plugins.fzf-lua" {
|
|
|
|
|
when = opts.iconsEnabled.isDefined;
|
|
|
|
|
|
|
|
|
|
message = ''
|
2024-11-19 15:47:49 +00:00
|
|
|
|
The option definition `plugins.fzf-lua.iconsEnabled' in ${lib.showFiles opts.iconsEnabled.files} has been deprecated; please remove it.
|
2025-01-29 14:16:00 +01:00
|
|
|
|
'';
|
|
|
|
|
};
|
|
|
|
|
|
2024-11-19 15:47:49 +00:00
|
|
|
|
# TODO: added 2024-09-20 remove after 24.11
|
|
|
|
|
plugins.web-devicons =
|
|
|
|
|
lib.mkIf
|
|
|
|
|
(
|
|
|
|
|
opts.iconsEnabled.isDefined
|
|
|
|
|
&& cfg.iconsEnabled
|
|
|
|
|
&& !(
|
|
|
|
|
config.plugins.mini.enable
|
|
|
|
|
&& config.plugins.mini.modules ? icons
|
|
|
|
|
&& config.plugins.mini.mockDevIcons
|
2024-09-20 12:50:26 -05:00
|
|
|
|
)
|
2024-11-19 15:47:49 +00:00
|
|
|
|
)
|
|
|
|
|
{
|
|
|
|
|
enable = lib.mkOverride 1490 true;
|
|
|
|
|
};
|
2023-12-08 16:34:34 +07:00
|
|
|
|
|
2024-11-19 15:47:49 +00:00
|
|
|
|
plugins.fzf-lua.settings.__unkeyed_profile = cfg.profile;
|
2024-08-29 09:41:26 -05:00
|
|
|
|
|
2024-11-19 15:47:49 +00:00
|
|
|
|
keymaps = mapAttrsToList (
|
|
|
|
|
key: mapping:
|
|
|
|
|
let
|
|
|
|
|
actionStr =
|
|
|
|
|
if isString mapping then
|
|
|
|
|
"${mapping}()"
|
|
|
|
|
else
|
2024-12-15 20:32:14 +01:00
|
|
|
|
"${mapping.action}(${lib.nixvim.toLuaObject mapping.settings})";
|
2024-11-19 15:47:49 +00:00
|
|
|
|
in
|
|
|
|
|
{
|
|
|
|
|
inherit key;
|
|
|
|
|
mode = mapping.mode or "n";
|
|
|
|
|
action.__raw = "function() require('fzf-lua').${actionStr} end";
|
|
|
|
|
options = mapping.options or { };
|
|
|
|
|
}
|
|
|
|
|
) cfg.keymaps;
|
|
|
|
|
};
|
2023-12-08 16:34:34 +07:00
|
|
|
|
}
|