mirror of
https://github.com/nix-community/nixvim.git
synced 2025-08-01 00:24:59 +02:00
modules/dependencies: add ripgrep
This commit is contained in:
parent
238ffa110a
commit
d6cdbf36b2
7 changed files with 54 additions and 59 deletions
|
@ -17,11 +17,19 @@ lib.nixvim.plugins.mkNeovimPlugin {
|
|||
You may want to set the package for your find/replace tool(s) like shown below:
|
||||
|
||||
```nix
|
||||
plugins.spectre.findPackage = pkgs.rg;
|
||||
plugins.spectre.replacePackage = pkgs.gnused;
|
||||
```
|
||||
'';
|
||||
|
||||
imports = [
|
||||
# TODO: added 2025-04-07, remove after 25.05
|
||||
(lib.nixvim.mkRemovedPackageOptionModule {
|
||||
plugin = "spectre";
|
||||
packageName = "ripgrep";
|
||||
oldPackageName = "find";
|
||||
})
|
||||
];
|
||||
|
||||
settingsOptions =
|
||||
let
|
||||
mkEngineOption =
|
||||
|
@ -231,11 +239,6 @@ lib.nixvim.plugins.mkNeovimPlugin {
|
|||
let
|
||||
defaults = config.plugins.spectre.settings.default;
|
||||
|
||||
# NOTE: changes here should also be reflected in the `defaultText` below
|
||||
findPackages = {
|
||||
rg = pkgs.ripgrep;
|
||||
};
|
||||
|
||||
# NOTE: changes here should also be reflected in the `defaultText` below
|
||||
replacePackages = {
|
||||
sed = pkgs.gnused;
|
||||
|
@ -243,24 +246,6 @@ lib.nixvim.plugins.mkNeovimPlugin {
|
|||
};
|
||||
in
|
||||
{
|
||||
findPackage = lib.mkOption {
|
||||
type = with lib.types; nullOr package;
|
||||
default = findPackages.${toString defaults.find.cmd} or null;
|
||||
defaultText = literalMD ''
|
||||
Based on the value defined in `config.plugins.spectre.settings.default.find.cmd`,
|
||||
if the value defined there is a key in the attrset below, then the corresponding value is used. Otherwise the default will be `null`.
|
||||
|
||||
```nix
|
||||
{
|
||||
rg = pkgs.ripgrep;
|
||||
}
|
||||
```
|
||||
'';
|
||||
description = ''
|
||||
The package to use for the find command.
|
||||
'';
|
||||
};
|
||||
|
||||
replacePackage = lib.mkOption {
|
||||
type = with lib.types; nullOr package;
|
||||
default = replacePackages.${toString defaults.replace.cmd} or null;
|
||||
|
@ -282,8 +267,14 @@ lib.nixvim.plugins.mkNeovimPlugin {
|
|||
};
|
||||
|
||||
extraConfig = cfg: {
|
||||
dependencies =
|
||||
let
|
||||
defaults = cfg.settings.default;
|
||||
in
|
||||
{
|
||||
ripgrep.enable = lib.mkIf (defaults.find.cmd == "rg") (lib.mkDefault true);
|
||||
};
|
||||
extraPackages = [
|
||||
cfg.findPackage
|
||||
cfg.replacePackage
|
||||
];
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue