From 75d6e605a64d2f862942afb57f1ff5668d60ae52 Mon Sep 17 00:00:00 2001 From: Yigit Sever Date: Fri, 8 Oct 2021 00:05:34 +0300 Subject: bin: track bunch of scripts --- .local/bin/rfv | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100755 .local/bin/rfv (limited to '.local/bin/rfv') 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 @@ +#!/usr/bin/env bash + +# 1. Search for text in files using Ripgrep +# 2. Interactively narrow down the list using fzf +# 3. Open the file in Vim +IFS=: read -ra selected < <( + rg --color=always --line-number --no-heading --smart-case "${*:-}" | + fzf --ansi \ + --color "hl:-1:underline,hl+:-1:underline:reverse" \ + --delimiter : \ + --preview 'bat --color=always {1} --highlight-line {2}' \ + --preview-window='up:60%:+{2}+3/3:~3' +) +[ -n "${selected[0]}" ] && nvim "${selected[0]}" "+${selected[1]}" -- cgit v1.2.3-70-g09d2