FZF is an interactive Unix command-line tool written in the GO language.
You can use it to find any list contents, files, history commands, native bound hosts, processes, Git branches, processes, etc. All command line tools that can generate list output can be searched and found on FZF through pipe
Project address: github.com/junegunn/fz…
The installation
We can easily install it through the package management tool
-
Macos-brew download and install
brew install fzf #Install keyboard mapping and fuzzy hints $(brew --prefix)/opt/fzf/install Copy the code
-
Debian series – apt install FZF
-
Windows – Download and install from Release
-
Use Git to download and install
git clone --depth 1 https://github.com/junegunn/fzf.git ~/.fzf #The installation ~/.fzf/install Copy the code
update
- git:
cd ~/.fzf && git pull && ./install
- brew:
brew update; brew reinstall fzf
use
CTRL-T
Find an entry in the directory
Use Ctrl-t to find a file or directory in the paste directory to the command line
CTRL-R
Find History command
Use Ctrl-R to find and paste the selected history command to the command line, and you can toggle chronology and relevance sorting by pressing Ctrl-R again
shortcuts
In the output swap window
- Ctrl-j/CtrL-K/CtrL-N/CTRLK-n can be used to move the cursor up and down
- The Enter key is used to select the entry and Ctrl-c/Ctrl-g /Esc is used to exit
- In multi-select mode (-m), TAB and shift-tab are used for multi-select
- Mouse: Scroll up and down, select, double-click; Shift-click or shift-SCOLl is used in multi-select mode
Search syntax
FZF starts by default with “extened-search” mode, in which you can enter multiple space-separated search terms, such as ^ music.mp3 $, SBTRKT! fire.
Token | Match type | Description |
---|---|---|
sbtrkt | fuzzy-match | Matching SBTRKT |
^music | prefix-exact-match | Begin with music |
.mp3^ | suffix-exact-match | End with. Mp3 |
‘wild | exact-match(quoted) | Exact inclusion of wild |
! fire | inverse-exact-match | Does not contain the fire |
! .mp3$ | inverse-suffix-exact-match | It doesn’t end in.mp3 |
If you don’t want to use fuzzy match, can make an exact match with FZF – e symbol “|” the or matching can be done, for example
#Represents those that begin with core and end with go or rb or py
^core go$|rb$|py$
Copy the code
The preview window
You can preview text dynamically with FZF –preview ‘cat {}’, instead of using one cat at a time
More and more
For more excellent tools, please follow the wechat public account to obtain