Hacker News new | ask | show | jobs
by atoav 910 days ago
rg if you want to find stuff in files

fd if you want to find stuff in filenames

fzf for when you want a fuzzy menu type of search on top of this.

I can't recommend fzf enough you can do some really powerful stuff with it. If you don't know it: it gives you a fuzzy search on things you pipe into it. It is powerful because it also can do things like running special commands ("preview") on the currently selected entry/line and allows for displaying the output in a separate pane.

So you could build a thing that e.g. let's you search and multiselect (enqueue) your music collection and on each entry display audio metadata using a custom script.

Or a blazingly fast PDF-content searcher that opens the PDF in the end. The possibilities are endless.

Edit: Here a short video showing my basic git log alias: https://youtu.be/9W27D8lrn-s

    gl: aliased to git log --all --pretty=oneline --pretty=format:"%Cgreen%h%Creset %s %Cred%d%Creset" --color=always | fzf --ansi --preview 'git show --pretty=medium --color=always $(echo {} | cut -d" " -f1)' | cut -d" " -f1
1 comments

If you want to put this (fantastic, thank you very much for it!) command in your git toolbox, personally I did it like this:

1) create an executable script called `git-l` and put it in a place in your PATH, and make it executable 2) use `git l` to invoke it

You will avoid escaping hell and you can even expand/complicate it much more. The same extension principle works with other CLI tools like `kubectl`.