-
-
Save lijie2000/d527602e3e9544213ac5ac408b3bec20 to your computer and use it in GitHub Desktop.
Find in file using ripgrep, then fuzzy find matched filenames with fzf, preview match using bat
This file contains 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