nnn/plugins/finder

29 lines
744 B
Plaintext
Raw Normal View History

#!/usr/bin/env sh
# Description: Run custom search and list results in smart context
#
# Note: To enable multi select in fzf, export the following:
2020-05-04 14:47:40 +00:00
# - export FZF_DEFAULT_OPTS='--bind ctrl-a:select-all,ctrl-d:deselect-all,ctrl-t:toggle'
#
# Shell: POSIX compliant
2020-05-04 00:47:38 +00:00
# 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
2020-11-22 14:39:14 +00:00
if [ -n "$cmd" ]; then
printf "%s" "+l" > "$NNN_PIPE"
eval "$cmd" > "$NNN_PIPE"
fi