diff options
author | Arun Prakash Jana <engineerarun@gmail.com> | 2020-07-06 23:43:36 +0530 |
---|---|---|
committer | Arun Prakash Jana <engineerarun@gmail.com> | 2020-07-06 23:43:48 +0530 |
commit | 509f069818af696c4a144da2af2ec8f2655b89f1 (patch) | |
tree | 352194d2853d6ee91aa7dd93f6b7c860c32a3348 | |
parent | 709e7bd7ddfc9db7bb13e441b80953c9bb19dbbb (diff) | |
download | nnn-509f069818af696c4a144da2af2ec8f2655b89f1.tar.gz |
Add quick find (fd) and grep (rg) plugin examples
-rw-r--r-- | plugins/README.md | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/plugins/README.md b/plugins/README.md index 2af105e..fbc8628 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. |