Live data from Hacker News

So you've installed `fzf` – now what?

andrew-quinn.me

221–230 of 292 posts

Re: So you've installed `fzf` – now what?

#221
post #110

Maybe I'm just getting old, but I found most of the animations in this article to go too fast. I couldn't tell what was happening, couldn't tell what I was supposed to be looking at.

I agree, those animations were way too fast. I'm only 30 so it's probably not an age thing!

Re: So you've installed `fzf` – now what?

#222

Earlier quoted context omitted.

Thank you!! Why on earth isn't that the default. It always seemed weird that with multiple bash windows open, the commands from most of them weren't added to the history.

It is very useful just be careful when switching between shells and hitting the up arrow to get the previous command, as you may get something from another shell.

That will only happen if PROMPT_COMMAND also contains "history -c; history -r", right? "history -a" just saves it, but "history -c; history -r" clears memory history and reloads from disk.

Re: So you've installed `fzf` – now what?

#223

Earlier quoted context omitted.

Thank you!! Why on earth isn't that the default. It always seemed weird that with multiple bash windows open, the commands from most of them weren't added to the history.

I often have three or more terminals open, doing different tasks in each; I also often have cycles of work where I'll repeat the last three commands again (three up-arrows and a return). This breaks if one terminal's commands get inserted into another terminal's history.

Comment from the author:

"Ted, the change I suggest doesn't affect the independence of your sessions as you suggest. Each shell maintains a unique history in memory so modifying the history file has no affect on running terminals. The only time the history file is read is when you start a new terminal. I recommend you try my suggestion. Really, all I am doing is eliminating the race condition that causes the bash history file to have inconsistent data.

Thanks for the feedback."

Re: So you've installed `fzf` – now what?

#226
post #110

Maybe I'm just getting old, but I found most of the animations in this article to go too fast. I couldn't tell what was happening, couldn't tell what I was supposed to be looking at.

> Maybe I'm just getting old, but I found most of the animations in this article to go too fast. It's not that you're getting old and it's not that it's "too fast". The problem with many animations like this and why they make no sense whatsoever is because they cycle without adding a little pause... So you have no way to know when it's beginning and when it's ending. It's endemic on Github. Some .gif files are proper…

I wish asciinema was used for these instead of the gifs in article, GitHub, etc.

Re: So you've installed `fzf` – now what?

#227
post #218

Surprised Ctrl+T didn't get a mention. Maybe that's a zsh-only thing, but it's basically the same as his vim $(fzf) example, except I only have to type vim and then Ctrl+T. I use this all the time when I'm running unit tests from the command line for instance. Helps me quickly get the path to the file I want without needing to remember the details of the folder structure. Just Ctrl+T -> tests/GLPage will yield me tes…

There is also `**` for thing like ssh auto completion and others.

Re: So you've installed `fzf` – now what?

#228

I really like the suggested command ` $(fzf)` to quickly open files in relative to the directory I am in. However, when I abort the fuzzy find with esc, it still opens without a file input, which is not what I want, so I wrote a little script for my shell config to prevent this: fuzz() { file=$(fzf) if [ ${#file} -gt 0 ]; then nvim "$file" # or any editor you prefer else : fi }

You could also map to fzf and then do `$EDITOR `. This works as you’d expect and with any command. I believe the instructions to set it up are in the fzf readme.

Re: So you've installed `fzf` – now what?

#229

Fantastic article. I was exactly in the situation the article describes, I installed it, then, didn't find a use case. But that's because Ubuntu doesn't come with completion enabled by default. You have to add in your bashrc: if [ -e /usr/share/doc/fzf/examples/key-bindings.bash ]; then source /usr/share/doc/fzf/examples/key-bindings.bash fi The fzf and ubuntu docs don't mention you have to. Couldn't find easily how…

You do have to remember to use it, but the thing to keep in mind is that you can pipe a list of ANYTHING into it. Any list of text items you can search through with a text query is fair game. git log --oneline | fzf for example is one of my favorite tricks. Instead of scanning by eye or repeatedly grepping to find something, it's a live fuzzy filter. And depending on how deep you want to go you can then add key bindi…

And don't forget that your selection is printed to stdout:

    git log --oneline | fzf | cowsay
Sky's the limit.

Re: So you've installed `fzf` – now what?

#230

have no need for this, plenty fast without it. these two have been sufficient for all my needs: ctrl + r for most things history | grep for searching when i forget the exact command or want to see related commands. I don't want pull downs, pull ups, drop downs, expanded hamburger menu, hot dogs, another set of key strokes to remember how i started some service last month.

This example is hilarious to me:

    vi $(fzf)
He claims to save a bunch of keystrokes by using it this way. But the string literal `vi $(fzf)` is saved in ~/.bash_history, not the actual filename. So you have to memorize the filename, AND deal with all those hamburgers and hot dogs, if you ever wanna re-edit that file after closing it.
Post reply on HN