add fasd config/init

This commit is contained in:
Sebastian Tramp 2013-06-14 01:41:32 +02:00
parent a772e6b180
commit 8bf2a9bcdb
No known key found for this signature in database
GPG key ID: E8093B579D601B44
2 changed files with 30 additions and 0 deletions

25
fasd.zsh Normal file
View file

@ -0,0 +1,25 @@
# @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'

5
zshrc
View file

@ -32,9 +32,14 @@ sources+="$ZSH_CONFIG/private.zsh"
# completion config needs to be after system and private config
sources+="$ZSH_CONFIG/completion.zsh"
# fasd integration and config
sources+="$ZSH_CONFIG/fasd.zsh"
# Private aliases and adoptions added at the very end (e.g. to start byuobu)
sources+="$ZSH_CONFIG/private.final.zsh"
# try to include all sources
foreach file (`echo $sources`)
if [[ -a $file ]]; then