prezto/modules/fasd/init.zsh
huyz 3e5e108eaa Improve less options
Remove silly message on logout

display non-success exit value for every command

Add first version of modules and load them up

Add more paths

Allow the sharing of prezto files by differentiating ZDOTDIR and where temp cache files will go: _ZDOTDIR/HOME

remove Vim swap files

Allow for both a shared and personal overriding .zpreztorc

In shared system, put .zcompdump in user's home

Fix path of .zcompdump

Fixed names of prompt

Support callbacks to override user & host value & style

Fix transpose* bindings for vi and ^Y for emacs

Fixed ordering of paths
2012-12-12 01:23:51 -08:00

56 lines
1.1 KiB
Bash

#
# Maintains a frequently used file and directory list for fast access.
#
# Authors:
# Wei Dai <x@wei23.net>
# Sorin Ionescu <sorin.ionescu@gmail.com>
#
# Load dependencies.
pmodload 'editor'
# Return if requirements are not found.
if (( ! $+commands[fasd] )); then
return 1
fi
#
# Initialization
#
# huy: use the user's home directory
#cache_file="${0:h}/cache.zsh"
cache_file="${_ZDOTDIR:-$HOME}/.zprezto.fasd.cache.zsh"
if [[ "${commands[fasd]}" -nt "$cache_file" || ! -s "$cache_file" ]]; then
# Set the base init arguments.
init_args=(zsh-hook)
# Set fasd completion init arguments, if applicable.
if zstyle -t ':prezto:module:completion' loaded; then
init_args+=(zsh-ccomp zsh-ccomp-install zsh-wcomp zsh-wcomp-install)
fi
# Cache init code.
fasd --init "$init_args[@]" >! "$cache_file" 2> /dev/null
fi
source "$cache_file"
unset cache_file init_args
function fasd_cd {
local fasd_ret="$(fasd -d "$@")"
if [[ -d "$fasd_ret" ]]; then
cd "$fasd_ret"
else
print "$fasd_ret"
fi
}
#
# Aliases
#
# Changes the current working directory interactively.
alias j='fasd_cd -i'