mirror of
https://github.com/nix-community/nixvim.git
synced 2025-06-21 00:25:42 +02:00
modules/dependencies: add ripgrep
This commit is contained in:
parent
238ffa110a
commit
d6cdbf36b2
7 changed files with 54 additions and 59 deletions
|
@ -27,6 +27,7 @@ let
|
|||
default = "nodejs";
|
||||
example = "pkgs.nodejs_22";
|
||||
};
|
||||
ripgrep.default = "ripgrep";
|
||||
texpresso.default = "texpresso";
|
||||
tinymist.default = "tinymist";
|
||||
tree-sitter.default = "tree-sitter";
|
||||
|
|
|
@ -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
|
||||
];
|
||||
};
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
{
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
let
|
||||
|
@ -13,6 +12,19 @@ mkExtension {
|
|||
extensionName = "live_grep_args";
|
||||
package = "telescope-live-grep-args-nvim";
|
||||
|
||||
imports = [
|
||||
# TODO: added 2025-04-07, remove after 25.05
|
||||
(lib.nixvim.mkRemovedPackageOptionModule {
|
||||
plugin = [
|
||||
"telescope"
|
||||
"extensions"
|
||||
"live-grep-args"
|
||||
];
|
||||
packageName = "ripgrep";
|
||||
oldPackageName = "grep";
|
||||
})
|
||||
];
|
||||
|
||||
settingsOptions = {
|
||||
auto_quoting = defaultNullOpts.mkBool true ''
|
||||
Enable or disable auto quoting of searches.
|
||||
|
@ -56,14 +68,7 @@ mkExtension {
|
|||
theme = "dropdown";
|
||||
};
|
||||
|
||||
extraOptions = {
|
||||
grepPackage = lib.mkPackageOption pkgs "ripgrep" {
|
||||
nullable = true;
|
||||
example = "pkgs.gnugrep";
|
||||
};
|
||||
};
|
||||
|
||||
extraConfig = cfg: {
|
||||
extraPackages = [ cfg.grepPackage ];
|
||||
extraConfig = {
|
||||
dependencies.ripgrep.enable = lib.mkDefault true;
|
||||
};
|
||||
}
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
{
|
||||
lib,
|
||||
config,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
with lib;
|
||||
|
@ -22,13 +21,19 @@ lib.nixvim.plugins.mkNeovimPlugin {
|
|||
|
||||
maintainers = [ lib.maintainers.khaneliman ];
|
||||
|
||||
# TODO: Added 2023-11-06, remove after 24.11
|
||||
imports = [
|
||||
# TODO: Added 2023-11-06, remove after 24.11
|
||||
(mkRemovedOptionModule [
|
||||
"plugins"
|
||||
"todo-comments"
|
||||
"keymapsSilent"
|
||||
] "Use `plugins.todo-comments.keymaps.<COMMAND>.options.silent`.")
|
||||
|
||||
# TODO: added 2025-04-07, remove after 25.05
|
||||
(lib.nixvim.mkRemovedPackageOptionModule {
|
||||
plugin = "todo-comments";
|
||||
packageName = "ripgrep";
|
||||
})
|
||||
];
|
||||
|
||||
# TODO: Added 2024-08-16, remove after 24.11
|
||||
|
@ -407,10 +412,6 @@ lib.nixvim.plugins.mkNeovimPlugin {
|
|||
todoTrouble = "TodoTrouble";
|
||||
todoTelescope = "TodoTelescope";
|
||||
};
|
||||
|
||||
ripgrepPackage = lib.mkPackageOption pkgs "ripgrep" {
|
||||
nullable = true;
|
||||
};
|
||||
};
|
||||
|
||||
extraConfig = cfg: {
|
||||
|
@ -431,7 +432,7 @@ lib.nixvim.plugins.mkNeovimPlugin {
|
|||
}
|
||||
];
|
||||
|
||||
extraPackages = [ cfg.ripgrepPackage ];
|
||||
dependencies.ripgrep.enable = lib.mkDefault true;
|
||||
|
||||
keymaps = lib.pipe cfg.keymaps [
|
||||
(filterAttrs (n: keymap: keymap != null && keymap.key != null))
|
||||
|
|
|
@ -8,7 +8,6 @@
|
|||
plugins.spectre = {
|
||||
enable = true;
|
||||
|
||||
findPackage = pkgs.ripgrep;
|
||||
replacePackage = pkgs.gnused;
|
||||
};
|
||||
};
|
||||
|
|
|
@ -49,26 +49,26 @@
|
|||
};
|
||||
|
||||
custom-packages = {
|
||||
plugins.telescope = {
|
||||
plugins = {
|
||||
telescope = {
|
||||
enable = true;
|
||||
|
||||
extensions.live-grep-args = {
|
||||
enable = true;
|
||||
grepPackage = pkgs.gnugrep;
|
||||
extensions.live-grep-args.enable = true;
|
||||
};
|
||||
web-devicons.enable = true;
|
||||
};
|
||||
plugins.web-devicons.enable = true;
|
||||
dependencies.ripgrep.package = pkgs.gnugrep;
|
||||
};
|
||||
|
||||
no-packages = {
|
||||
plugins.telescope = {
|
||||
plugins = {
|
||||
telescope = {
|
||||
enable = true;
|
||||
|
||||
extensions.live-grep-args = {
|
||||
enable = true;
|
||||
grepPackage = null;
|
||||
extensions.live-grep-args.enable = true;
|
||||
};
|
||||
web-devicons.enable = false;
|
||||
};
|
||||
plugins.web-devicons.enable = false;
|
||||
dependencies.ripgrep.enable = false;
|
||||
};
|
||||
}
|
||||
|
|
|
@ -191,11 +191,9 @@
|
|||
};
|
||||
|
||||
without-ripgrep = {
|
||||
plugins.todo-comments = {
|
||||
enable = true;
|
||||
plugins.todo-comments.enable = true;
|
||||
|
||||
ripgrepPackage = null;
|
||||
};
|
||||
dependencies.ripgrep.enable = false;
|
||||
};
|
||||
|
||||
highlight-pattern-list = {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue