diff options
author | 2020-05-03 17:09:30 +0530 | |
---|---|---|
committer | 2020-05-03 19:03:42 +0530 | |
commit | af71d470f5a97e48c24afc43b60ca14b2b9fc8e1 (patch) | |
tree | 6831c31338db13c216e28210ee7c823bdb177960 /plugins/finder | |
parent | ebb6f153b51332ce2b64b3e717ea956484749d4c (diff) | |
download | nnn-af71d470f5a97e48c24afc43b60ca14b2b9fc8e1.tar.gz |
Plugin finder: run custom find/fd/grep/rg/fzf and list
Diffstat (limited to 'plugins/finder')
-rwxr-xr-x | plugins/finder | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/plugins/finder b/plugins/finder new file mode 100755 index 0000000..c3b2242 --- /dev/null +++ b/plugins/finder @@ -0,0 +1,28 @@ +#!/usr/bin/env sh + +# Description: Run custom search and list results in smart context +# +# Note: To enable multi select in fzf, export the following: +# - export FZF_DEFAULT_OPTS='--bind ctrl-a:select-all,ctrl-d:deselect-all' +# +# Shell: POSIX compliant +# Author: Arun Prakash jana + +. "$(dirname "$0")"/.nnn-plugin-helper + +printf "Examples:\n" +printf " find . -name \"pattern*\" -print0\n" +printf " fd pattern -0\n" +printf " find -maxdepth 1 -size +100M -print0\n" +printf " fd -d 2 -S +100M -0\n" +printf " grep -rlZ pattern\n" +printf " rg -l0 pattern\n" +printf " fzf -m | tr %s %s\n\n" "'\n'" "'\0'" + +printf "cmd: " +read -r cmd + +if ! [ -z "$cmd" ]; then + printf "%s" "+l" > "$NNN_PIPE" + eval "$cmd" > "$NNN_PIPE" +fi |