-
-
Save AdamGagorik/29e65ebe382396f91e6c4ed6301a5453 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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%,border-bottom,+{2}+3/3,~3' | |
) | |
[ -n "${selected[0]}" ] && vim "${selected[0]}" "+${selected[1]}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment