Live data from Hacker News

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

andrew-quinn.me

201–210 of 292 posts

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

#201
The meaning of

    find . '/'
Was not immediately apparent to me. It will first search the current directory, then search from the root directory of the filesystem. This is useful (beyond just `find` which is implicitly `find .`) because it will turn up local results quickly and global results eventually.

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

#202
The article is a pretty helpful collection of examples, and I appreciate it.

The intro irks me, though:

> Software engineers are, if not unique, then darn near unique in the ease with which we can create tools to improve our own professional lives; this however can come at a steep cost over time for people who constantly flit back and forth between different tools without investing the time to learn their own kit in depth. As someone with a healthy respect for the tacit knowledge of people better than me, I think a great 80/20 heuristic is “Learn the oldies first”: venerable Unix tools like cat, ls, cd, grep, and cut. (sed and awk, too, if you have the good fortune of landing yourself in an actual modern sysadmin role.)

This seems to be either naive or hubristic in light of the thousands of years of history of craftspeople building their own workspaces. Even a hobbyist woodworker will build plenty of jigs and fixtures for their work. Machinists as well. Anyone whose work comprises building things is readily capable of applying those skills to make their work easier

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

#203

> And I found myself asking: Where the heck is nginx.conf? The author lists some ways but misses the standard Unix way: simply use locate https://en.m.wikipedia.org/wiki/Locate_(Unix) Using locate maybe piped to grep is good enough for all my finding needs

`locate` doesn't seem to be on everything, unlike `find`. Same with `adduser` vs `useradd`. Both were a rude awakening to me later on as I hadn't learned the hard/common versions.

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

#204

The article is a pretty helpful collection of examples, and I appreciate it. The intro irks me, though: > Software engineers are, if not unique, then darn near unique in the ease with which we can create tools to improve our own professional lives; this however can come at a steep cost over time for people who constantly flit back and forth between different tools without investing the time to learn their own kit in…

unique in the ease with which we can create tools to improve our own professional lives

I think the key line is the ease in which we can create tools. A software engineer has free access to the lumber yard. Builders of old had to work hard to create tools to create tools.

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

#205

Am I the only one that tried fzf as a replacement to the default Ctrl+R behavior, then switched back? I'm perfectly satisfied with the default Ctrl+R functionality, to the point that fzf seemed to add visual clutter without any value. I guess I was never let down by inverse search. Context: I'm using Linux and doing SWE and SRE work, and constantly live in the terminal.

When I learned what Ctrl-R was originally, by mistake, I was like damn... maybe the majority of shell users just have no idea how to drive bash. No wonder people lose their shit over it, it's like trying to drive a car but you're never told the car can go in reverse and the rear view mirror is just tucked up into the roof!

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

#206
For windows, I like everything search https://www.voidtools.com/ It let you search all your files and folders instantly as long as they are ntfs partions, and there is no heavy background indexing needed(it still need to do index but it's very light since it use ntfs file journal to build it) .

I also customize it so I can click the folder in the UI and open it in total commander.

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

#207

The article is a pretty helpful collection of examples, and I appreciate it. The intro irks me, though: > Software engineers are, if not unique, then darn near unique in the ease with which we can create tools to improve our own professional lives; this however can come at a steep cost over time for people who constantly flit back and forth between different tools without investing the time to learn their own kit in…

unique in the ease with which we can create tools to improve our own professional lives I think the key line is the ease in which we can create tools. A software engineer has free access to the lumber yard. Builders of old had to work hard to create tools to create tools.

No capital costs, and seldom held back by constraints of the existing tools were using to build the next tool.

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

#208
post #57

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…

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…

Same, I enjoyed atuin but found myself missing fzf's fuzzy search experience so I ported fzf's own ctrl-r zsh widget to read from atuin instead of the shell's history to solve this. Best of both worlds imo, you get fzf's fuzzy search experience and speed with atuin's shell history management and syncing functionality.

Zsh snippet below in case it's helpful to anybody. With this in your .zshrc ctrl-r will search your shell history with fzf+atuin and ctrl-e will bring up atuin's own fuzzy finder in case you still want it.

It only searches the last 5000 entries of your atuin history for speed, but you can tweak ATUIN_LIMIT to your desired value if that's not optimal.

    atuin-setup() {
        if ! which atuin &> /dev/null; then return 1; fi
        bindkey '^E' _atuin_search_widget

        export ATUIN_NOBIND="true"
        eval "$(atuin init "$CUR_SHELL")"
        fzf-atuin-history-widget() {
            local selected num
            setopt localoptions noglobsubst noposixbuiltins pipefail no_aliases 2>/dev/null

            # local atuin_opts="--cmd-only --limit ${ATUIN_LIMIT:-5000}"
            local atuin_opts="--cmd-only"
            local fzf_opts=(
                --height=${FZF_TMUX_HEIGHT:-80%}
                --tac
                "-n2..,.."
                --tiebreak=index
                "--query=${LBUFFER}"
                "+m"
                "--bind=ctrl-d:reload(atuin search $atuin_opts -c $PWD),ctrl-r:reload(atuin search $atuin_opts)"
            )

            selected=$(
                eval "atuin search ${atuin_opts}" |
                    fzf "${fzf_opts[@]}"
            )
            local ret=$?
            if [ -n "$selected" ]; then
                # the += lets it insert at current pos instead of replacing
                LBUFFER+="${selected}"
            fi
            zle reset-prompt
            return $ret
        }
        zle -N fzf-atuin-history-widget
        bindkey '^R' fzf-atuin-history-widget
    }
    atuin-setup

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

#209
post #73

Other uses for fzf: - Combine it with autojump[1] and quickly navigate to any directory you've navigated to before (sorted by frequency). This is crazy helpful. - Use it for git branch names - Use it for ssh locations [1] https://github.com/wting/autojump

how do I use it with autojump?

Here is the autojump function for fzf/bash

https://github.com/junegunn/fzf/wiki/examples#autojump

You'll have to comment out the j() function in /usr/share/autojump/autojump.sh

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

#210

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…

FYI, speaking as a skim library user/lover, two things -- 1) it's really not maintained, and 2) once you dig into the code it gets a little gnarly.

I have a branch[0] where I'm trying to do things like reduce the user perceptible lag in search, the initial time of ingest, and add small features I need, etc (all done). I've tried to create PRs where I can, and they go unnoticed and unused.

One other thing I was trying to get a handle on is memory usage. The issue is -- you're implicitly creating objects with static lifetimes everywhere. Now try to refactor that, and there is a trait object held in a struct which depends on another trait object, so good luck figuring out the lifetimes. This is totally fine for a fuzzy finder tool, probably, but less fine when you drop a fuzzy find feature it into an app.

Love to have others interested in skim, and eager to work with anyone with big ideas about how to make it better. I'll have to try out atuin!

[0]: https://github.com/kimono-koans/two_percent

Post reply on HN