Skip to content

Instantly share code, notes, and snippets.

@josephholsten
Last active June 21, 2017 22:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save josephholsten/c459459db99275f39dc0081c6fe062fa to your computer and use it in GitHub Desktop.
Save josephholsten/c459459db99275f39dc0081c6fe062fa to your computer and use it in GitHub Desktop.
fasd with fzf for interactive selection
# same default aliases as fasd, but with fzf(1) for interactive selection
# fzf(1)
export FZF_DEFAULT_COMMAND='ag -g ""'
FZF_PATH="/usr/local/opt/fzf"
if [ -f "$COMPLETION_PATH" ]; then
source "$FZF_PATH/shell/completion.bash"
source "$FZF_PATH/shell/key-bindings.bash"
fi
eval "$(fasd --init bash-hook bash-ccomp bash-ccomp-install)"
alias a='fasd -a'
alias d='fasd -d'
alias f='fasd -f'
function s() {
f=$(a "$@" | fzf +m -n2 --tac | awk '{print $2}')
fasd -A "$f"
echo "$f"
}
function sd() {
f=$(d "$@" | fzf +m -n2 --tac | awk '{print $2}')
fasd -A "$f"
echo "$f"
}
function sf() {
f=$(f "$@" | fzf +m -n2 --tac | awk '{print $2}')
fasd -A "$f"
echo "$f"
}
function z() {
f=$(d "$@" | fzf +m -n2 --tac | awk '{print $2}')
fasd -A "$f"
cd "$f"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment