#!/usr/bin/env sh
#
# usage:
#   - take any `rg` invocation and replace the `rg` with `vimrg`
#   - should work with flags like -g and -t, etc.
#   - assumes that the search pattern is last (shouldn't fail if that's not the
#     case, but will set Vim's search register to the value of the last argument)
#
# shellcheck disable=SC2312

set -e

# ${EDITOR:-vim} -c ":Grepper -query --glob='!test' $(env printf ' %q' "$@")" -c ":let @/='${!#}'"
${EDITOR:-vim} -c ":Grepper -query $(env printf ' %q' "$@")" -c ":let @/='${!#}'"
