Fuzzy search text / notes in the terminal. Blazingly fast, incremental searching and editing using fzf, ripgrep and vim. Used daily for 5+ years.
Why use Fuz?
- Point to a directory of text files
- Fuz instantly and interactively returns search matches (see above)
- Supports markdown and code highlighting
- File contents are memory mapped for faster results
- Cleverly ignores large binary files and hidden directories
- Works well with Obsidian / Roam like note-taking apps, searching your git repo and code snippets
# 0. Install requirements (see below)
# 1. Download and install Fuz
git clone https://github.com/Magnushhoie/fuz/
cd fuz && chmod +x fuz
# 2. Run setup to set a default search directory
./fuz --setup
# 3. Interactively search default directory or path with fuz
fuz
fuz --path .
# A) MacOS: First install brew (https://brew.sh/) then run
brew install fzf rg bat
# B) Any system: Use conda https://conda.io/docs/user-guide/install/
conda install -c conda-forge fzf ripgrep bat
# C) Linux/Ubuntu (requires sudo):
sudo apt-get install fzf ripgrep
sudo apt install bat
# Batcat should be aliased to bat to work with fuz
mkdir -p ~/.local/bin
ln -s /usr/bin/batcat ~/.local/bin/bat
USAGE:
fuz [options] <FILENAME and/or SEARCH-TERMS>
Fuz interactively fuzzy searches a directory and
opens selected files at search result.
Use --edit to list files and edit in vim,
or --open for system default app
Project homepage: https://github.com/Magnushhoie/fuz
EXAMPLES:
- Search text from default path
fuz
- Search specific path
fuz --path DIRECTORY
- Search filenames to edit with vim:
fuz --edit
- Open matches with system default text editor
fuz --open
KEY BINDINGS:
CTRL+O Open in vim
CTRL+L View with less
CTRL+J MOVE down
CTRL+K MOVE up
ALTERNATIVE TERMINAL EDITOR:
# add to .bashrc/.zshrc (currently supports neovim, macvim or vim):
export FUZ_EDITOR=nvim
OPTIONS:
--setup Set fuz default search directory in .zsh/.bashrc
-p, --path Directory to search
-o, --open Open search directory or file with system default application
-e, --edit Open file with vim editor (instead of 'less'), enables --names option
-n, --names Only show filenames
-c, --create Create new file in search directory: --create <FILENAME>
-d, --max-depth Max search depth (5)
-m, --max-lines Max lines read per file (50000)
-s, --max-size Max file-size to search (1M)
-f, --fuzzy-search Enable fuzzy instead of exact search
--sorttime Sort chronologically, files by date modified, preserve line order (single threaded, slow)
--vimsearch Search lines and open in vim
--dir Print and open search directory
-h, --help Print this help and exit
# Exports Apple Notes to text in ~/_macosx_notes
osascript -l JavaScript macosx_notes2txt.AppleScript
# Setup alias to point to the directory in .bashrc/.zshrc
# Then use 'nfz' to fuz the ~/_macosx_notes directory
echo 'alias nfz="fuz -p ~/_macosx_notes"' >> ~/.zshrc
echo 'alias nfze="fuz -e -p ~/_macosx_notes"' >> ~/.zshrc
Compatible with bash 3.2+ and zsh 5.9+. Tested on Ubuntu 21.04 and MacOS Monterey/Mojave/Big Sur.
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
Please make sure to update tests as appropriate.