This is a plugin for zsh heavily inspired by PatrickF1/fzf.fish.
It's still a work in progress, and has slightly different keybindings.
For git status to work with Ctrl+Alt+S, make sure to disable ixon in your .zshrc:
if [[ $- == *i* ]]; then
stty -ixon < /dev/tty
fi| Keybinding | Description |
|---|---|
Ctrl+Alt+F |
File search using fzf |
Ctrl+R |
History search using fzf |
Alt+c |
Change directory using fzf |
Ctrl+Alt+L |
Git log search using fzf |
Ctrl+Alt+S |
Git status search using fzf |
Ctrl+Alt+G |
Grep using fzf |
Ctrl+V |
Environment variables search using fzf |
Ctrl+Alt+W |
Find a package name using fzf |
Ctrl+Alt+B |
Blame search using fzf |
antidote install scaryrawr/fzf.zshgit clone https://github.com/scaryrawr/fzf.zsh $ZSH_CUSTOM/plugins/fzfYou can customize the behavior of the fzf plugin by setting the following environment variables:
| Variable Name | Description | Passed Argument |
|---|---|---|
FZF_DEFAULT_OPTS |
Default options for fzf | N/A |
FZF_FD_OPTS |
Additional options to pass to fd | N/A |
FZF_PREVIEW_CMD |
Command to use for file preview | file path |
FZF_GIT_BLAME_PREVIEW_CMD |
Command to use for git blame preview | file path |
FZF_GIT_COMMIT_PREVIEW_CMD |
Command to use for git commit preview | commit |
FZF_GIT_LOG_PREVIEW_CMD |
Command to use for git log preview | commit |
FZF_DIFF_PREVIEW_CMD |
Command to use for diff preview | diff |
FZF_GIT_STATUS_PREVIEW_CMD |
Command to use for git status preview | file path |
FZF_PACKAGE_PREVIEW_CMD |
Command to use for package preview | package name |
You can override the default keybindings using the FZF_KEYBINDINGS associative array before sourcing the plugin:
# In your .zshrc, before loading the plugin:
typeset -gA FZF_KEYBINDINGS
FZF_KEYBINDINGS[fzf-file-widget]='^F' # Change file widget to Ctrl+F
FZF_KEYBINDINGS[fzf-history-widget]='^H' # Change history widget to Ctrl+H
FZF_KEYBINDINGS[fzf-cd-widget]='' # Disable cd widget (empty string)| Widget Name | Default Keybinding | Description |
|---|---|---|
fzf-file-widget |
^[^F |
File search using fzf |
fzf-history-widget |
^R |
History search using fzf |
fzf-cd-widget |
^[c |
Change directory using fzf |
fzf-git-log-widget |
^[^L |
Git log search using fzf |
fzf-git-status-widget |
^[^S |
Git status search using fzf |
fzf-variables-widget |
^V |
Environment variables search using fzf |
fzf-package-widget |
^[^W |
Find a package name using fzf |
fzf-git-blame-widget |
^[^B |
Blame search using fzf |
| Notation | Meaning |
|---|---|
^ |
Ctrl |
^[ |
Alt/Meta (Escape sequence) |
^[^ |
Alt/Meta followed by Ctrl (e.g., ^[^L means Alt+Ctrl+L) |
To add a new widget, create a file in the widgets/ directory following the naming convention fzf-<name>-widget.zsh. The plugin will automatically:
- Source the widget file
- Register it as a ZLE widget
- Bind it to a key (if configured in
FZF_KEYBINDINGS)
Example widget file (widgets/fzf-custom-widget.zsh):
fzf-custom-widget() {
local selected=$(your-command | fzf)
if [[ -n "$selected" ]]; then
LBUFFER="${LBUFFER}$selected"
fi
zle redisplay
}Then add a keybinding before sourcing the plugin:
typeset -gA FZF_KEYBINDINGS
FZF_KEYBINDINGS[fzf-custom-widget]='^[^X' # Alt+Ctrl+X






