My 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
Fzf – the basics part 1 – layout
31–40 of 40 posts
Re: Fzf – the basics part 1 – layout
#32I 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/tra…
Re: Fzf – the basics part 1 – layout
#33Re: Fzf – the basics part 1 – layout
#34I 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/tra…
That'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
Re: Fzf – the basics part 1 – layout
#35Earlier quoted context omitted.
I 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
I've moved to https://github.com/ajeetdsouza/zoxide/ from z, as it can also show you a list of matching directories using fzf
# 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,.]* *//')"
}Re: Fzf – the basics part 1 – layout
#36Fzf might be my most used command line utility. That and autojump (alias to j).
I'm a big fan of autojump but switch to the Rust port recently. https://github.com/ajeetdsouza/zoxide
Thanks, I was using https://github.com/badmotorfinger/z for powershell before. I will check it out.
Re: Fzf – the basics part 1 – layout
#37I 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/tra…
That'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
npmrf () {
local script
script=$(jq -r '.scripts | to_entries[] | "\(.key) => \(.value)"'
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).Re: Fzf – the basics part 1 – layout
#38plocate 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/ I don't actually use it. It's more a fun ha…
thanks for this, I just replaced my mlocate. absolutely unreal. seems io_uring makes all the difference.
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.
Re: Fzf – the basics part 1 – layout
#39fzy[1] is a less bloated alternative, written in C. fzf is neat, but it does too much. [1]: https://github.com/jhawthorn/fzy
fzf 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.
Re: Fzf – the basics part 1 – layout
#40This 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.