aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/finder
blob: 649b711351da1ddd46ff7e94b2a1a6b54911677d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
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,ctrl-t:toggle'
#
# 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