-
-
Save emjayoh/12cfaa1ceeeaace3a1dcb1e7b9f4289a to your computer and use it in GitHub Desktop.
[fif.sh - fuzzy + rg + bat] Find in file using ripgrep, then fuzzy find matched filenames with fzf, preview match using bat #fzf #terminal #bash #shell #bat #rg #function
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
fif() { | |
rg \ | |
--column \ | |
--line-number \ | |
--no-column \ | |
--no-heading \ | |
--fixed-strings \ | |
--ignore-case \ | |
--hidden \ | |
--follow \ | |
--glob '!.git/*' "$1" \ | |
| awk -F ":" '/1/ {start = $2<5 ? 0 : $2 - 5; end = $2 + 5; print $1 " " $2 " " start ":" end}' \ | |
| fzf --preview 'bat --wrap character --color always {1} --highlight-line {2} --line-range {3}' --preview-window wrap | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment