> fzf
Get fuzzy

Why?
- Ergonomic way to get input in shell commands
- -> improves your efficiency with a Terminal
- Generic tool
- Easy to extend
What is fuzzy finding?
src/client/dummy.js scdjs
src/server/makes-sense.css sserversense
What does fzf do?
One thing. It fuzzy finds.
Default features:
- fzf
- kill <TAB>
- cat <CTRL-T>
- vim <CTRL-T>
- anything <CTRL-T>
Use cases examples
- Git: fuzzy find commits
- Git: start interactive rebase on fuzzy found commit
- Docker: start a bash on a container
- Docker: restart a container
- Vim (with plugin): open a file
- Open a recent file (using fasd)
- ...
- Many more: https://github.com/junegunn/fzf/wiki/examples
Create custom commands
How to do it:
- Give proper input:
- one line = one element
- Format output properly
- needs to match your program's needs
d3f2acf4 Fix typo
faad34df lol
f4adcd69 Fix tests
bcad0e69 wip
d3f2acf4 Fix typod3f2acf4git log --pretty=oneline
fzf
git show
post-treatment
pre-treatment
Git commands
Fuzzy find commits:
git log --pretty=oneline
| fzf -n 2..
| awk '{print $1}'
| xargs git showGit commands
Fuzzy interactive rebase:
git log --pretty=oneline
| fzf -n 2..
| awk '{print $1\"^\"}'
| xargs git rebase -iDocker commands
Launch bash on a docker container
dbash() {
CONTAINER=$(docker ps | awk '{print $1, $2}'
| awk 'NR > 1'
| fzf -n 2..
| awk '{print $1}')
# Cleaner and more generic solution:
# docker ps --format '{{.ID}} {{.Names}}'
# | fzf -n 2..
# | awk '{print $1}'
if [ ! -z "$CONTAINER" ]
then
docker exec -it $CONTAINER bash
fi
}
Questions?
FZF
By Pierre Poupin
FZF
- 251