标签:Items vim everything mac under exact fzf match
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 {}'
-
可以配合管道使用
标签:Items,vim,everything,mac,under,exact,fzf,match 来源: https://www.cnblogs.com/bonelee/p/15518020.html
本站声明: 1. iCode9 技术分享网(下文简称本站)提供的所有内容,仅供技术学习、探讨和分享; 2. 关于本站的所有留言、评论、转载及引用,纯属内容发起人的个人观点,与本站观点和立场无关; 3. 关于本站的所有言论和文字,纯属内容发起人的个人观点,与本站观点和立场无关; 4. 本站文章均是网友提供,不完全保证技术分享内容的完整性、准确性、时效性、风险性和版权归属;如您发现该文章侵犯了您的权益,可联系我们第一时间进行删除; 5. 本站为非盈利性的个人网站,所有内容不会用来进行牟利,也不会利用任何形式的广告来间接获益,纯粹是为了广大技术爱好者提供技术内容和技术思想的分享性交流网站。