7 ms·
Fzf – the basics part 1 – layout
- icy 6y agofzy[1] is a less bloated alternative, written in C. fzf is neat, but it does too much. [1]: https://github.com/jhawthorn/fzy https://github.com/jhawthorn/fzy
- jclulow 6y agoBut does it really? Can one not simply not use the features one doesn't need? Also, I fully appreciate not rewriting things that are C and already working just because -- but surely if something is already written in a safer language then C isn't really a step forward either.
- ithrow 6y agoYeah, well, that's just, like, your opinion...
- kenhwang 6y agoThere's also skim[1], which would be a Rust fzy alternative. But neither fzy nor skim quite do what fzf does, which is offer an simple feature-filled experience out of the box. The big draw is fzf Just Works™. I don't mind that it feels bloated and slow sometimes, because I don't want to spend a week figuring out how to make the other two do what fzf does without configuration or drama, and all the speed improvements in the world doesn't really matter when the bottleneck is the meatball behind the keyboard. [1]https://github.com/lotabout/skim https://github.com/lotabout/skim
- forrestthewoods 6y agoI really wish skim ran on Windows :(
- kenhwang 6y agoThere's always WSL ¯\_(ツ)_/¯
- bhaak 6y agoThe real advantage of fzy over fzf is that fzy is actually better at guessing what you want (the documentation claims it's also faster but I never noticed a difference). That fzy also forces you to think about good input providers (like fd instead of find) is just following the Unix philosophy of one tool doing what it's best at.
- jbrnh 6y agofzf never struck me as the slightest bit slow. What am I doing wrong? You can configure it with an external previewer that can of cause be arbitrarily slow or bloated but you can hardly fault fzf for that.
- gpanders 6y agoIn my experience fzf actually feels faster simply because it’s able to begin populating the output list before it finishes reading the input list. This means you get selection options immediately, whereas with fzy there can be a delay. This is particularly noticeable when working with large inputs (e.g. anything in the Linux kernel)
- waynesonfire 6y agothis garbage tool was installed on my mac recently through I think an update and took over my shell by injecting itself into my bashrc. I learned that the built in history search in bash requires one less key press to use.
- sethammons 6y agoFzf might be my most used command line utility. That and autojump (alias to j).
- mpalmer 6y agoI use it everywhere because it basically gives you a list-based UI layer over shell functions. It's endlessly useful and admirably unix-y.
- shscs911 6y agoI use z[0] in place of autojump. That way I don't need to install Python solely for autojump. This is especially true, when sshing to servers. [0]:https://github.com/rupa/z https://github.com/rupa/z
- konart 6y agoor its zsh native port https://github.com/agkozak/zsh-z https://github.com/agkozak/zsh-z
- tra3 6y agoTheres also fasd. It has z emulation. https://github.com/clvv/fasd https://github.com/clvv/fasd
- theblazehen 6y agoI've moved to https://github.com/ajeetdsouza/zoxide/ https://github.com/ajeetdsouza/zoxide/ from z, as it can also show you a list of matching directories using fzf
- mssundaram 6y ago# https://github.com/junegunn/fzf/wiki/Examples#integration-with-z # like normal z when used with arguments but displays an fzf prompt when used without. unalias z 2> /dev/null z() { [ $# -gt 0 ] && _z "$*" && return cd "$(_z -l 2>&1 | fzf --height 40% --nth 2.. --reverse --inline-info +s --tac --query "${*##-* }" | sed 's/^[0-9,.]* *//')" }
- itsmenow 6y agoThis thing is magical! I use it as a quick scientific paper finder. Basically have a folder with, probably thousands by now, papers (each file's name contains paper title, authors, year, journal) and by typing a couple words can fuzzy search for stuff by whatever fields. It also works incredibly nicely with vim as a fuzzy search for either files or phrases within files.
- sneeuwpopsneeuw 6y agoA nice, I do the same but I convert all books, papers and powerpoints to pdf files with a rondom name or i use a hash of the content as name. Then in use ripgrepall with fzf to search for the information i'm looking for.
- graton 6y agoMy favorite ~/.gitconfig [alias] that uses fzf: # Allows you to easily pick what to rebase frbi = "!f() { git rebase -i $(git log --pretty=oneline --color=always | fzf --ansi | cut -d ' ' -f1)^ ; }; f" Then just do: git frbi
- tarruda 6y agoThis is a gem, thanks!
- BurpyDave 6y agolove this, shows how simple fzf is to use as well. just gives us a nice way to pick out a line from git log. Beautiful.
- skrebbel 6y agoSame! I use it for switching between branches: sw = !git checkout $(git branch -a --format '%(refname:short)' | sed 's~origin/~~' | sort | uniq | fzf) Just type `git sw` and fzfuzzy type the branch name you want to go to.
- dansomething 6y agoHere's some additional FZF Git love posted by junegunn a while back. https://junegunn.kr/2016/07/fzf-git/ https://junegunn.kr/2016/07/fzf-git/
- Foxboron 6y agoplocate is a very fast mlocate alternative that uses indexes over trigrams and io_uring for reading the database. With fzf you can have a pretty fast fuzzy search over your entire indexed disk. FZF_DEFAULT_COMMAND="plocate ''" \ fzf --bind "change:reload:plocate {q} || true" \ --ansi --phony --query "" --preview 'file {}' --bind '?:preview:cat {}' https://plocate.sesse.net/ https://plocate.sesse.net/ I don't actually use it. It's more a fun hack.
- DyslexicAtheist 6y agothanks for this, I just replaced my mlocate. absolutely unreal. seems io_uring makes all the difference.
- Sesse__ 6y agoHi, I'm the author of plocate. io_uring is not the primary part of the difference; it makes for a pretty good win if you have rotating disks (especially when you have many matches to test), but on SSD, it's pretty much inconsequential. The biggest difference really comes from the use of an index, as opposed to matching every single candidate against the pattern.
- chisquared 6y agoPersonally, I'm a fan of using fzf with tmux 3.2+ so I get popup windows instead. They're great.
- djohnston 6y agoFZF is the one tool I evangelize to all new hires. Just that with infinite history saves hours of development time per year.
- jugjug 6y agoI love fzf as well. I use it with the npm package manager to select the script to run (we have an app with 20+ scripts): npmrf () { local script script=$(cat package.json | jq -r '.scripts | keys[] ' | sort | fzf) && npm run $script } Another usecase is tracking hours with Clockify. I was frustrated opening up the web everytime, so I wrote a script using fzf, httpie and jq. Love it now. [1] [1]: https://marcel.is/tracking-hours/ https://marcel.is/tracking-hours/
- mssundaram 6y agoThat's a great idea, thanks. Do you know how to get it to show the preview window with the script value? Sometimes I need to explore which script task I need based on what it does
- jugjug 6y agoYeah, that would be nice. I don't know though from the top of my head.
- zjmil 6y agoYou could do something like this (not super thoroughly tested): npmrf () { local script script=$(jq -r '.scripts | to_entries[] | "\(.key) => \(.value)"' < package.json | sort | fzf | cut -d' ' -f1) && npm run "$script" } It uses jq's to_entries to pull out the script/command key pairs and then just cuts out the script name after you choose the command (assumes the command name doesn't have spaces).
- wodenokoto 6y agoI haven't had the chance to test this, but this add-on promises to be able to pipe _any_ tab-completion suggestions from your shell into fzf, which to me sounds like the pinnacle of fzf awesomeness. https://github.com/lincheney/fzf-tab-completion https://github.com/lincheney/fzf-tab-completion