Skip to main content

Fish Shell Integration

Fish shell has first-class fzf support through fzf --fish and the community fzf.fish plugin.

Method 1: Built-in Fish Support (fzf 0.48+)

~/.config/fish/config.fish
# Load fzf shell integration for fish
fzf --fish | source

This provides the same CTRL-T, CTRL-R, ALT-C bindings as bash/zsh.

fzf.fish by PatrickF1 is a richer, fish-native integration:

# Install fisher (fish plugin manager)
curl -sL https://raw.githubusercontent.com/jorgebucaran/fisher/main/functions/fisher.fish | source && fisher install jorgebucaran/fisher

# Install fzf.fish
fisher install PatrickF1/fzf.fish

fzf.fish Key Bindings

KeyAction
Ctrl+FSearch files (fzf_search_directory)
Ctrl+Alt+FSearch git tracked files
Ctrl+RSearch history
Ctrl+Alt+LSearch git log
Ctrl+Alt+SSearch git status
Ctrl+VSearch variables
Ctrl+PSearch processes
Alt+CSearch directory to cd into

Configuring fzf.fish

~/.config/fish/config.fish
# Set variables to customize behavior
set fzf_preview_dir_cmd eza --all --color=always # or: ls -la
set fzf_preview_file_cmd bat --color=always --style=numbers

# Change directory preview
set fzf_directory_opts --bind='ctrl-/:toggle-preview'

# fd integration for file search
set fzf_fd_opts --hidden --follow --exclude=.git

# History (avoid duplicates)
set fzf_history_opts --scheme=history --no-sort

Fish Functions with fzf

~/.config/fish/functions/fcd.fish
# Interactive cd with preview
function fcd
set dir (fd --type d --hidden --follow --exclude .git \
| fzf --preview 'tree -C {} | head -100' \
--preview-window 'right:40%' \
--header 'CTRL-/ to toggle preview')
if test -n "$dir"
cd $dir
end
end
~/.config/fish/functions/fopen.fish
# Open file with preview
function fopen
set file (fd --type f --hidden \
| fzf --preview 'bat --color=always --style=numbers {}' \
--preview-window 'right:60%' \
--bind 'ctrl-/:toggle-preview')
if test -n "$file"
$EDITOR $file
end
end
~/.config/fish/functions/fssh.fish
# fzf SSH host picker
function fssh
set host (grep -E "^Host " ~/.ssh/config 2>/dev/null \
| awk '{print $2}' \
| grep -v '\*' \
| fzf --header 'SSH Host' --prompt 'Connect to> ')
if test -n "$host"
ssh $host
end
end

What's Next