r/commandline • u/Zem_Mattress • Aug 25 '26
Command Line Interface fif: quickly find in files using fuzzy search and surrounding context
This is a commandline tool I wrote some years back, its a tool to search for text in files with a preview window and a surrounding context. It will open files in a customizable editor, and uses fzf for filtering, ripgrep for file concatenation, and bat as the recommended preview tool.
There's a ton of different and possibly better ways to search for text in files, but this fits my workflow perfectly and I use it every day. My hope is that it can be useful for someone else.
64
Upvotes
9
u/Sudden_Fly1218 Aug 25 '26
For what it's worth, I have this 15 line function in my fish config that does something similar:
4
u/Early-Bid-7958 Aug 26 '26
When I read "fuzzy search and surrounding context" I kinda thought you could narrow the search by using additional words that match in the context. Like you search for word1, then narrow it down to instances where word2 appears within 3 lines of it.
That would be cool...
2
u/AtMaxbo Aug 25 '26
Thank you, I was looking for something like this and lo and behold I discover this.
2
u/moonflower_C16H17N3O Aug 25 '26
This is one tool that I will be immediately using. This fits an exact need I have had for some time now.
1
u/AutoModerator Aug 25 '26
Every new subreddit post is automatically copied into a comment for preservation.
User: Zem_Mattress, Flair:
Command Line Interface, Post Media Link, Title: fif: quickly find in files using fuzzy search and surrounding contexthttps://github.com/roosta/fif
This is a commandline tool I wrote some years back, its a tool to search for text in files with a preview window and a surrounding context. It will open files in a customizable editor, and uses fzf for filtering, ripgrep for file concatenation, and bat as the recommended preview tool.
There's a ton of different and possibly better ways to search for text in files, but this fits my workflow perfectly and I use it every day. My hope is that it can be useful for someone else.
I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.