diff options
Diffstat (limited to '.local/bin/rfv')
| -rwxr-xr-x | .local/bin/rfv | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/.local/bin/rfv b/.local/bin/rfv new file mode 100755 index 0000000..4c9a632 --- /dev/null +++ b/.local/bin/rfv | |||
| @@ -0,0 +1,14 @@ | |||
| 1 | #!/usr/bin/env bash | ||
| 2 | |||
| 3 | # 1. Search for text in files using Ripgrep | ||
| 4 | # 2. Interactively narrow down the list using fzf | ||
| 5 | # 3. Open the file in Vim | ||
| 6 | IFS=: read -ra selected < <( | ||
| 7 | rg --color=always --line-number --no-heading --smart-case "${*:-}" | | ||
| 8 | fzf --ansi \ | ||
| 9 | --color "hl:-1:underline,hl+:-1:underline:reverse" \ | ||
| 10 | --delimiter : \ | ||
| 11 | --preview 'bat --color=always {1} --highlight-line {2}' \ | ||
| 12 | --preview-window='up:60%:+{2}+3/3:~3' | ||
| 13 | ) | ||
| 14 | [ -n "${selected[0]}" ] && nvim "${selected[0]}" "+${selected[1]}" | ||
