Skip to content

Possible to use alias/function for the shells used by fzf? #3993

Answered by LangLangBart
enoryw asked this question in Q&A
Discussion options

You must be logged in to vote

Can the above be restructured to get the same effect

yes.

shell script - what is the zsh equivalent of bash's export -f - Unix & Linux Stack Exchange


Most common is to store the function in a variable name.

cmd='fd -t d --hidden --no-ignore --follow --ignore-file "$HOME/.config/fd/ignore" --ignore-file "$HOME/.config/fd/cd-fzf.fdignore" .'

selection=$(fzf --preview 'tree -C {}' \
  --prompt 'Dirs > ' \
  --bind "start:reload:$cmd '$HOME' /etc /media /data /data2" \
  --bind "ctrl-r:transform:[[ ! \$FZF_PROMPT == 'Dirs > ' ]] &&
    echo \"change-prompt(Dirs > )+reload($cmd '$HOME' /etc /media /data /data2)\" ||
    echo \"change-prompt(Dirs (media excluded) > )+reload($cmd /etc '$HOME/…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by enoryw
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants