TL;DR
Here is the default behavior.
find ~/ -name *.git 2>/dev/null | dmenu
# Searches everything in home directory and shows output
Time taken about 1-2 sec
What I want:
find ~/ -name *.git 2>/dev/null | less
# Show as soon as it finds result. How to get similar output in dmenu?
As files in my PC will increase, this is going to take longer time.
Detailed description:
I am piping input into dmenu from a find command which takes about 1-2 seconds. Is it possible for dmenu to show input as soon as there is some input in the pipe. Because that's the basic working of piping. It seems like dmenu waits until there are all the entries in pipe so that user can search from it which also looks legit, but still can this be avoided? I would like to run dmenu as soon as there is input in buffer.
I found some workaround to decrease time against
findhere. Instead offind,locatecan be used. So the command goes like-rtakes input a regular expression. Arguments to-rhere filters all git repositories inside/home/$USER. This is a bit faster than usingfind.Catch using
locatelocateuses a local database for searching. So it will only work as expected when local database will be built/updated.To update database, use
sudo updatedb. Whenever you add/move/delete a file (or a directory in this case), remember to update database forlocateto give proper results.Update
I recently realized why use
locatewhen I can simply maintain my own database and cat all the entries todmenu. With this I was able to achieve what I needed.This gives a fuzzy finding for directories with
dmenu. This is better than usinglocateas even inlocateyou need to update local database and so in here. Since we do the filtering of git files at runtime withlocate, it is a bit slower than this case.I can simple create an alias to update this database analogous to
sudo updatedbin case oflocate, byNote that I am not using
/tmp/as it won't be persistent across power cycles. So rather I create my own$HOME/.tmp/directory.