zff is a bash script that lets you quickly find and open files using fzf, prioritizing vim oldfiles, zoxide directories, and then your current working directory.
Note
Only Bash and Zsh shells are supported
- Smart Prioritization: (n)vim oldfiles(with snacks.picker frecency support) > CWD > zoxide dirs
- Speed: Uses
fdandrgwithfzffor insane speed - Preview support: Supports thumbnails for images and videos.
- Inserter function: uses a bash/zsh widget to insert the path(s) into your current command
- Customizable: Extensive config options for icons, depths, ignores, score thresholds and more
fzf: For interactive fuzzy finding and UIfd: For file searching (Zoxide and CWD)rg: For filtering oldfileszoxide(optional): For zoxide directories supportbat(optional): For syntax-highlighted code previews.ffmpegthumbnailer(optional): For video thumbnails in the preview pane.chafaorimg2sixel(optional): For image previews in the terminal.(chafais recommended as it supports more formats)- Note: images previews are builtin for KGP supported terminals (Kitty, Ghostty, Wezterm) and don't require any dependency
git clone https://github.com/sahaj-b/zff.gitAdd the source command to your shell's config file (.bashrc or .zshrc)
# assuming you cloned zff to ~/zff
if [[ -f ~/zff/zff.sh ]]; then
source ~/zff/zff.sh
fiJust run zff
The selected file will open in your $EDITOR (nvim by default) or xdg-open if it's not a text file.
You can bind it to a keybind if you want. (see Zsh widget example below)
The script provides a function called zffi.
- Bash: A keybind is set up for you by default. Just hit
Ctrl+T. Change keybind in Config if you want - Zsh: You need to bind the
zffiwidget yourself. Add this to your.zshrcto map it toCtrl+T:zle -N zffi bindkey '^T' zffi # Ctrl + T
You can also create a widget to run zff on a keybind.
- For
zshzff-widget() { zff zle reset-prompt } bindkey '^O' zff # Ctrl + O
- For `bash
bind '"\C-o":"zff\n"'
When you press Ctrl + space, this one opens files (zff) when the prompt is empty, and inserts paths (zffi) if its not
zff-widget() {
if [[ -n "$BUFFER" ]]; then
# Insert path if typed something
zffi
else
# Empty prompt: open file
zff
zle reset-prompt
fi
}
zle -N zff-widget
bindkey '^@' zff-widget # Ctrl + spaceTip
Ctrl + cto copy selected path to clipboard (change your copy command in config if needed)Ctrl + u/Ctrl + dto go half page up/down in the list- You can change these behavior by editing the fzf command in main file
- Use
tab/shift + tabto select/unselect multiple files to insert
- Create a file at
XDG_CONFIG_HOME/zff/config.sh(~/.config/zff/config.sh) to customize yourzffexperience. - This script supports a wide range of configuration options, from setting custom icons to defining search depths and ignore patterns.
- See example_config.sh for all available options with defaults
Low end systems may experience some lag due to large number of files. You can
- Reduce search depths (recommended) and score threshold
- Add more ignore patterns in the config file to improve performance.
- Disable preview in config