Created
April 17, 2024 10:16
-
-
Save aldosch/dbc7c0553a7cef6e84ffd64d10d636d2 to your computer and use it in GitHub Desktop.
fif() – find in file
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
# find in file | |
fif() { | |
if [ ! "$#" -gt 0 ]; then echo "Need a string to search for!"; return 1; fi | |
rg --files-with-matches --no-messages "$1" | fzf --preview "highlight -O ansi -l {} 2> /dev/null | rg --colors 'match:bg:yellow' --ignore-case --pretty --context 10 '$1' || rg --ignore-case --pretty --context 10 '$1' {}" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment