Hanging around the Kakoune community, I occasionally see people asking questions about how to integrate fuzzy-find tools like fzf into Kakoune, and it seems to be quite difficult. So I wondered how hard it would be to do it the other way around: build a fuzzy-find tool on top of Kakoune’s :prompt
command.
It turns out, it’s pretty easy! One thing I did learn while writing it, though, is that when you launch a process from a shell script, it inherits the file-descriptors of the shell, unless you’re starting the process in the background, in which case it will have its stdin redirected from /dev/null
. So if you have a shell-script and need to redirect its’ stdin to somewhere else while you do other things, you need to do a little dance to avoid the shell’s default behaviour.