mac everything的替代品——fzf使用,速度还是很快的!!!
fzf模糊搜索神器的安装和使用
fzf是一个通用的命令行模糊查找器, 通过输入模糊的关键词就可以定位文件或文件夹。结合其他工具(比如rg)可以完成非常多的工作,在工作中可以大幅提高你的工作效率。
fzf可以用于文件、命令历史记录、进程、主机名、书签、git提交等。
1. fzf使用
1.1 安装
Using Homebrew
You can use Homebrew (on macOS or Linux) to install fzf.
brew install fzf
# To install useful key bindings and fuzzy completion:
$(brew --prefix)/opt/fzf/install
1.2 使用
安装后, 可以执行下fzf
, 先体验下, 另外 fzf 重写了 ctrl+r
搜索历史命令
vim $(fzf) # 搜索后, 回车直接用 vi 打开
|
-
搜索过程中, CTRL-J 和 CTRL-K 向上翻和向下翻
-
bash和zsh的模糊完备, 默认触发是
**
, 例如:vim **<TAB>
, 或cd **<TAB>
, 或ssh **<TAB>
, 简直好用到飞起.-
# Files under the current directory # - You can select multiple items with TAB key vim **<TAB> # Files under parent directory vim ../**<TAB> # Files under parent directory that match `fzf` vim ../fzf**<TAB> # Files under your home directory vim ~/**<TAB> # Directories under current directory (single-selection) cd **<TAB> # Directories under ~/github that match `fzf` cd ~/github/fzf**<TAB>
-
-
一边查一边预览
-
ps -ef | fzf
seq 100 | fzf
history | fzf
1.3 搜索语法
Token | Match type | Description |
---|---|---|
sbtrkt |
fuzzy-match | Items that match sbtrkt |
'wild |
exact-match (quoted) | Items that include wild |
^music |
prefix-exact-match | Items that start with music |
.mp3$ |
suffix-exact-match | Items that end with .mp3 |
!fire |
inverse-exact-match | Items that do not include fire |
!^music |
inverse-prefix-exact-match | Items that do not start with music |
!.mp3$ |
inverse-suffix-exact-match | Items that do not end with .mp3 |
-
fzf --preview 'cat {}'
-
可以配合管道使用
标签:
linux
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
· 理解Rust引用及其生命周期标识(上)
· 浏览器原生「磁吸」效果!Anchor Positioning 锚点定位神器解析
· 没有源码,如何修改代码逻辑?
· 全程不用写代码,我用AI程序员写了一个飞机大战
· MongoDB 8.0这个新功能碉堡了,比商业数据库还牛
· 记一次.NET内存居高不下排查解决与启示
· 白话解读 Dapr 1.15:你的「微服务管家」又秀新绝活了
· DeepSeek 开源周回顾「GitHub 热点速览」
2018-11-06 Intel daal数据预处理
2016-11-06 spark collect获取所有元素