summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnton Bobov <anton@bobov.name>2024-09-20 00:33:21 +0500
committerAnton Bobov <anton@bobov.name>2024-09-20 00:34:19 +0500
commitb697e7a84e51fa1fa234be8898df15b1370fccec (patch)
treeb08cd26fdd0ee8a36c545f69ab31264df6a52536
parent429916071ca0b59dc221cfd68fe80207e0e4f2d8 (diff)
Add ripgrep interactive search using fzf
-rwxr-xr-xrfv12
1 files changed, 12 insertions, 0 deletions
diff --git a/rfv b/rfv
new file mode 100755
index 0000000..23914a2
--- /dev/null
+++ b/rfv
@@ -0,0 +1,12 @@
+#!/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
+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%,border-bottom,+{2}+3/3,~3' \
+ --bind 'enter:become(vim {1} +{2})'