Repository: phiresky/ripgrep-all (language: rust)

Issue:
rga-fzf() for fish-shell users
- UPDATE
run with any `shell` as `cli` need force `bash` as default shell for `fzf` like that:
```bash
#!/bin/bash

export SHELL=bash

rga-fzf() {
 ....
}

rga-fzf
```



Discussion / hints:
Found this somewhere, couldn't test it because I got an old fish version (2.7.1)

```
function rga-fzf
    set -x RG_PREFIX rga --files-with-matches
    set -l file
    set file (
        FZF_DEFAULT_COMMAND="$RG_PREFIX '$argv'" \
            fzf --sort --preview="[ ! -z {} ] && rga --pretty --context 5 {q} {}" \
                --phony -q "$argv" \ --bind "change:reload:$RG_PREFIX {q}" \
                --preview-window="70%:wrap"
    ) &&
    open "$file"
end
```
thank you, it's work  
but must add a new line before `--bind`
>```
> function rga-fzf
>...
>                 --phony -q "$argv" \ 
>                 --bind "change:reload:$RG_PREFIX {q}" \
>...
> end
> ```


Created another version with help from `babelfish` and edited it so it also accepts more flags if needed.

```fish
function rga-fzf
    set RG_PREFIX 'rga --files-with-matches --sort=path'
    if test (count $argv) -gt 1
        set RG_PREFIX "$RG_PREFIX $argv[1..-2]"
    end
    set -l file $file
    set file (
        FZF_DEFAULT_COMMAND="$RG_PREFIX '$argv[-1]'" \
        fzf --sort --preview='test ! -z {} && \
                rga --pretty \
                    --context 5 {q} {}' \
            --phony -q "$argv[-1]" \
            --bind "change:reload:$RG_PREFIX {q}" \
            --preview-window='50%:wrap'
    ) && \
    echo "opening $file" && \
    open "$file"
end
```

Example to include pdfs only: `rga-fzf -tpdf "my search query"`

Fix patch:
diff --git a/README.md b/README.md
index 5549bf3e..f9db959c 100644
--- a/README.md
+++ b/README.md
@@ -51,6 +51,28 @@ rga-fzf() {
 }
 ```
 
+And for your `~/.config/fish/config.fish`:
+```
+function rga-fzf
+    set RG_PREFIX 'rga --files-with-matches'
+    if test (count $argv) -gt 1
+        set RG_PREFIX "$RG_PREFIX $argv[1..-2]"
+    end
+    set -l file $file
+    set file (
+        FZF_DEFAULT_COMMAND="$RG_PREFIX '$argv[-1]'" \
+        fzf --sort \
+            --preview='test ! -z {} && \
+                rga --pretty --context 5 {q} {}' \
+            --phony -q "$argv[-1]" \
+            --bind "change:reload:$RG_PREFIX {q}" \
+            --preview-window='50%:wrap'
+    ) && \
+    echo "opening $file" && \
+    open "$file"
+end
+```
+
 ## INSTALLATION
 
 Linux x64, macOS and Windows binaries are available [in GitHub Releases][latestrelease].


Test patch: