diff options
Diffstat (limited to 'bin')
| -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 "$@" + |
