aboutsummaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorAlec Goncharow <alec@goncharow.dev>2025-04-20 15:46:33 -0400
committerAlec Goncharow <alec@goncharow.dev>2025-04-20 15:48:01 -0400
commit973673083f215451b7674a22533b4e7dfdfb81fd (patch)
treebe7942cc9e98755edeb24427e4776b75e7485f73 /bin
parent78efc3eb493b40ad2f79408a47bb873b5eea9db0 (diff)
maybe useful
idk
Diffstat (limited to 'bin')
-rwxr-xr-xbin/rgf27
1 files changed, 27 insertions, 0 deletions
diff --git a/bin/rgf b/bin/rgf
new file mode 100755
index 0000000..881359d
--- /dev/null
+++ b/bin/rgf
@@ -0,0 +1,27 @@
+#!/usr/bin/env bash
+
+set -o errexit
+set -o nounset
+if [[ "${TRACE-0}" == "1" ]]; then
+ set -o xtrace
+fi
+
+main() {
+ result=$(rg --ignore-case --color=always --line-number --no-heading "$@" |
+ fzf --ansi \
+ --color 'hl:-1:underline,hl+:-1:underline:reverse' \
+ --delimiter ':' \
+ --preview "bat --color=always {1} --theme='gruvbox-dark' --highlight-line {2}" \
+ --preview-window 'up,60%,border-bottom,+{2}+3/3,~3')
+
+
+ file=${result%%:*}
+ line=$(echo "${result}" | cut -d: -f2)
+
+ if [[ -n "$file" ]]; then
+ nvim +"${line}" "$file"
+ fi
+}
+
+main "$@"
+