From: Arun Prakash Jana Date: Mon, 6 Jul 2020 18:13:36 +0000 (+0530) Subject: Add quick find (fd) and grep (rg) plugin examples X-Git-Tag: v3.3~8 X-Git-Url: http://www.git.stargrave.org/?a=commitdiff_plain;h=509f069818af696c4a144da2af2ec8f2655b89f1;p=nnn.git Add quick find (fd) and grep (rg) plugin examples --- diff --git a/plugins/README.md b/plugins/README.md index 2af105e7..fbc8628b 100644 --- a/plugins/README.md +++ b/plugins/README.md @@ -250,6 +250,36 @@ There are many plugins provided by `nnn` which can be used as examples. Here are disown ``` +- Quick find (using `fd`) + ```sh + #!/usr/bin/env sh + + . "$(dirname "$0")"/.nnn-plugin-helper + + printf "pattern: " + read -r pattern + + if ! [ -z "$pattern" ]; then + printf "%s" "+l" > "$NNN_PIPE" + eval "fd -HI $pattern -0" > "$NNN_PIPE" + fi + ``` + +- Quick grep (using `rg`) + ```sh + #!/usr/bin/env sh + + . "$(dirname "$0")"/.nnn-plugin-helper + + printf "pattern: " + read -r pattern + + if ! [ -z "$pattern" ]; then + printf "%s" "+l" > "$NNN_PIPE" + eval "rg -l0 --hidden -S $pattern" > "$NNN_PIPE" + fi + ``` + ## Contributing plugins 1. Add informative sections like _Description_, _Notes_, _Dependencies_, _Shell_, _Author_ etc. in the plugin.