diff options
| author | Alec Goncharow <alec@goncharow.dev> | 2025-04-20 15:46:33 -0400 |
|---|---|---|
| committer | Alec Goncharow <alec@goncharow.dev> | 2025-04-20 15:48:01 -0400 |
| commit | 973673083f215451b7674a22533b4e7dfdfb81fd (patch) | |
| tree | be7942cc9e98755edeb24427e4776b75e7485f73 /bin/rgf | |
| parent | 78efc3eb493b40ad2f79408a47bb873b5eea9db0 (diff) | |
maybe useful
idk
Diffstat (limited to 'bin/rgf')
| -rwxr-xr-x | bin/rgf | 27 |
1 files changed, 27 insertions, 0 deletions
@@ -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 "$@" + |
