Live data from Hacker News

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

andrew-quinn.me

91–100 of 292 posts

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

#93
post #57

Earlier quoted context omitted.

I wanted to like atuin. The idea is great. But it just could not match the instant search that ctrl-r with fzf offers sadly. There is always a noticeable delay that annoyed me and made me revert back to fzf for search. For me another issue was that I needed to do more keystrokes for the same behaviour (search a previously ran command and execute it). Fuzzy shell history search is just one of those mind-blowing things…

I also had a rather noticeable delay when launching atuin. As it turns out, this was because it checked for an update every time it launched! You can disable that update check: add a ` update_check = false` to your `~/.config/atuin/config.toml` [1]. That made the delay pretty much disappear for me. [1]: https://atuin.sh/docs/config/#update_check

What? I don't expect any tool to interact with the network if it's not made specifically for this (curl, netcat, etc). This would betray my expectations, I find it unacceptable.

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

#94
I've made a simple tagging solution based on fzf and don't know how to live without it anymore.

You just name your folders and subfolders by tags. And then search it via fzf (I prefer the exact search) launched by a hotkey.

To exclude a subfolder from the global search I use a trick. You add the stop symbol " #" at the end of the subfolder name. A custom fzf configuration (see below) then excludes what's the inside. Though, you still can cd into the excluded folder and make fzf search in it. So, in fact it gives you an hierarchy of tagged folders with stop symbols. This helps to avoid search pollution and unnecessary disk reads:

  export FZF_DEFAULT_COMMAND="fd -E=**/*#/**"
I also use hotkeys to open items in default programs and to preview files in fzf UI:

  export FZF_DEFAULT_OPTS="--exact \
  --bind 'ctrl-/:execute-silent(xdg-open {} &)' \
  --bind 'ctrl-p:toggle-preview'"
Of course, it still requires a strong discipline to tag everything appropriately. But the profit is immense - you can find everything you remember and open it in the default program in a matter of seconds.

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

#95
post #17

fzf is super useful for navigating and switching git branches I realised today [1] function gbll(){ local tags branches target branches=$( git --no-pager branch --sort=-committerdate \ --format="%(if)%(HEAD)%(then)%(else)%(if:equals=HEAD)%(refname:strip=3)%(then)%(else)%1B[0;34;1mbranch%09%1B[m%(refname:short)%(end)%(end)" \ | sed '/^$/d') || return tags=$( git --no-pager tag | awk '{print "\x1b[35;1mtag\x1b[m\t" $1}…

Agree I use fzf extensively in my git aliases:

https://github.com/kbd/setup/blob/master/HOME/.config/git/co...

Perfect example: my "cherry pick" alias:

    cp = !git pick-branch | xargs git pick-commits | tac | xargs -t git cherry-pick
Those "pick-" aliases pop up fzf to let me choose a branch, then commits to cherry pick. No more copying hashes anywhere.

Similarly, my alias for git add lets me fzf-select a list of files to stage based on what "git status" reports.

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

#96

I have `,fv` running `nvim $(fzf)` and it's actually a little annoying because afterwards I can't find the filename that I had open. I wish there were some way to expand it into my history.

You can: Help for bash 'history -s args': The args are added to the end of the history list as a single entry

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

#97

I love fuzzy shell history. Game changer in terms of shell productivity. I use atuin[0] instead of fzf as I find the experience a bit nicer and it has history backups built in (disclaimer, I am a maintainer) Some of our users still prefer fzf because they are used to how it fuzzy finds, but we're running an experiment with skim[1] which allows us to embed the fuzzy engine without much overhead - hopefully giving them…

Something I've always wanted from my shell history is to be able to record relative filepaths as their absolute equivalent in the history, is that supported in atuin?. If you do a lot of data munging on the CLI, you end up with a lot of commands like `jq 'complicated_selector' data.json`, which if I want to remember the selector is good, but if I want to remember which data I ran it on is not so good. I could do it w…

File paths are just strings from the shell, though, and each tool can handle relative paths differently. So `./` can mean relative to your shell's cwd or the program could interpret it as relative to something else. Moreover something like `go test -v ./...` is...ambiguous.

I think what would be more useful is to record `env` or some similar context along with the time and command. That would probably get weird pretty fast, though. Maybe just a thing that could insert some useful bookmarking/state into the history record on-demand? `history-set-checkpoint` or something would save your pwd and local vars or something.

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

#99
post #17

fzf is super useful for navigating and switching git branches I realised today [1] function gbll(){ local tags branches target branches=$( git --no-pager branch --sort=-committerdate \ --format="%(if)%(HEAD)%(then)%(else)%(if:equals=HEAD)%(refname:strip=3)%(then)%(else)%1B[0;34;1mbranch%09%1B[m%(refname:short)%(end)%(end)" \ | sed '/^$/d') || return tags=$( git --no-pager tag | awk '{print "\x1b[35;1mtag\x1b[m\t" $1}…

https://github.com/bigH/git-fuzzy
Post reply on HN