zshrc/fasd.zsh

26 lines
669 B
Bash

# @author Sebastian Tramp <mail@sebastian.tramp.name>
# @license http://opensource.org/licenses/gpl-license.php
#
# fasd integration
# https://github.com/clvv/fasd
#
# init fasd, the autojump successor
#eval "$(fasd --init auto)"
eval "$(fasd --init zsh-hook zsh-ccomp zsh-ccomp-install zsh-wcomp zsh-wcomp-install)"
# fasd_cd + outputs directory
fasd_cd() {
if [ $# -le 1 ]; then
fasd "$@"
else
local _fasd_ret="$(fasd -e 'printf %s' "$@")"
[ -z "$_fasd_ret" ] && return
[ -d "$_fasd_ret" ] && print "$_fasd_ret" && cd "$_fasd_ret" || printf %s\n "$_fasd_ret"
fi
}
# as an autojump user, i need only this for now
alias j=' fasd_cd -d'