Skip to content

Commit

Permalink
plugins/grug-far: init
Browse files Browse the repository at this point in the history
  • Loading branch information
khaneliman committed Dec 12, 2024
1 parent 54b1d91 commit 2844c31
Show file tree
Hide file tree
Showing 2 changed files with 80 additions and 0 deletions.
23 changes: 23 additions & 0 deletions plugins/by-name/grug-far/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{ lib, ... }:
lib.nixvim.neovim-plugin.mkNeovimPlugin {
name = "grug-far";
originalName = "grug-far.nvim";
package = "grug-far-nvim";

maintainers = [ lib.maintainers.khaneliman ];

settingsExample = {
debounceMs = 1000;
minSearchChars = 1;
maxSearchMatches = 2000;
normalModeSearch = false;
maxWorkers = 8;
engine = "ripgrep";
engines = {
ripgrep = {
path = "rg";
showReplaceDiff = true;
};
};
};
}
57 changes: 57 additions & 0 deletions tests/test-sources/plugins/by-name/grug-far/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
{
empty = {
plugins.grug-far.enable = true;
};

# Just a small subset of the settings
defaults = {
plugins.grug-far = {
enable = true;

settings = {
debounceMs = 500;
minSearchChars = 2;
maxSearchMatches = 2000;
normalModeSearch = false;
maxWorkers = 4;
engine = "ripgrep";
engines = {
ripgrep = {
path = "rg";
extraArgs = "";
showReplaceDiff = true;
placeholders = {
enabled = true;
search = "ex: foo foo([a-z0-9]*) fun\\(";
replacement = ''ex: bar $${1}_foo $$MY_ENV_VAR'';
replacement_lua = ''ex: if vim.startsWith(match; "use") \\n then return "employ" .. match \\n else return match end'';
filesFilter = ''ex: *.lua *.{css;js} **/docs/*.md (specify one per line)'';
flags = "ex: --help --ignore-case (-i) --replace= (empty replace) --multiline (-U)";
paths = "ex: /foo/bar ../ ./hello\\ world/ ./src/foo.lua ~/.config";
};
};
};
};
};
};

example = {
plugins.grug-far = {
enable = true;
settings = {
debounceMs = 1000;
minSearchChars = 1;
maxSearchMatches = 2000;
normalModeSearch = false;
maxWorkers = 8;
engine = "ripgrep";
engines = {
ripgrep = {
path = "rg";
showReplaceDiff = true;
};
};
};
};
};
}

0 comments on commit 2844c31

Please sign in to comment.