From f8842da27a66677f44063b366f770b9d4cbd97d3 Mon Sep 17 00:00:00 2001 From: gbstan Date: Fri, 22 Nov 2019 10:27:45 +0000 Subject: [PATCH] Updated Examples (markdown) --- Examples.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/Examples.md b/Examples.md index b0efe61..14eec89 100644 --- a/Examples.md +++ b/Examples.md @@ -295,6 +295,16 @@ fif() { } ``` +# alternative using ripgrep-all (rga) combined with preview +# allows to search in PDFs, E-Books, Office documents, zip, tar.gz, etc. (see https://github.com/phiresky/ripgrep-all) +# find-in-file - usage: fif +```sh +fif() { + if [ ! "$#" -gt 0 ]; then echo "Need a string to search for!"; return 1; fi + rga --ignore-case --files-with-matches --no-messages "$1" | fzf-tmux --preview "highlight -O ansi -l {} 2> /dev/null | rga --ignore-case --pretty --context 10 "$1" {}" +} +``` + ### Command history ```sh