Fuzzy search using fzf
Fzf is a smart command line tool to find files and folders. Just forget about typing file paths.
For example:
- I don’t have to write paths for any files or folders because fzf do this job using a fuzzy search
- Actually fzf is a very usable console interface to filter any lists, files, command history, processes, hostnames, bookmarks, git commits, etc.
- You can write your own tools with fzf to increase your productivity
It’s easy to install fzf using git: https://github.com/junegunn/fzf#using-git
After the installation is complete you will be able to use in your terminal:
- <CTRL+T> list files + folders in current directory (recursively)
- <CTRL+R> search history of shell commands
- <ALT+C> fuzzy change directory (works without cd command) These default features are very usable.
More important is configuring functions that will help you to build your software products. My current functions:
- open file by text (recursively)
- open file by name (recursively)
- interactive cd
Below the code of the bash functions:
As you can see ‘open file by text’ requires silversearcher-ag. Put these functions to your .zshrc/.bashrc file to call them from anywhere.
Hope fzf and the functions will help you and make the world better.