fzf
fzf is a general-purpose command-line fuzzy finder.
# Shell Integration
http://junegunn.github.io/fzf/shell-integration/ (opens new window)
CTRL + T: complete the command using fzfCTRL + R: 搜索历史命令CTRL-/: see the whole command
Option + C: 搜索目录(直接 cd 进去)。
# support
https://junegunn.github.io/fzf/examples/directory-navigation/ (opens new window)
# fzf-git
fzf-github (opens new window) project provides a bunch of key bindings for completing Git objects. You should definitely check it out. example (opens new window)
# tricks
# 1. 在shell中浏览任何目录下的文件内容
本方案借助 raycast 的 snippets 功能
- 在 raycast 中创建 snippet
cat $(find {clipboard} -type f 2>/dev/null | fzf --preview="cat {} | head -50"), 取名 <snippet_name> - 复制需要浏览的目录,然后打开 raycast。 搜素上述 <snippet_name>。 按Enter触发文件浏览
# 2. git 高效切换分支
# 1
git branch | fzf | cut -c 3- | xargs git checkout
# 2. 输出纯净的分支名,省去 cut 这一步
git branch --format='%(refname:short)' | fzf | xargs git checkout
1
2
3
4
5
2
3
4
5
注: 另一个更加高效的可以使用 fzf-git 支持。 具体可以参照fzf-git
# 3. 选择Android手机的当天媒文件并保存到本地
file=$(adb shell ls /sdcard/Pictures/Screenshots | grep $(date +%Y%m%d) | tr -d '\r' | fzf --prompt="选择需要pull的媒体文件") && [ -n "$file" ] && adb pull "/sdcard/Pictures/Screenshots/$file"
1
# link
- fzf-github (opens new window) github 官网
- fzf-io (opens new window) useful
上次更新: 2026/06/10, 14:42:19
- 01
- cloudeflare06-07
- 03
- VisiData 终极生存指南(vd)04-27