1
0
Fork 0
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
prezto/modules/fasd/init.zsh

41 lines
1.2 KiB

13 years ago
#
# Command-line productivity booster, offers quick access to files and directories.
#
# Authors:
# Sorin Ionescu <sorin.ionescu@gmail.com>
# Wei Dai <x@wei23.net>
#
13 years ago
if (( ! $+commands[fasd] )); then
return 1
fi
cache_file="${0:h}/cache.zsh"
13 years ago
if [[ "$(which fasd)" -nt "$cache_file" || ! -s "$cache_file" ]]; then
# Base init arguments
init_args='posix-alias zsh-hook'
13 years ago
# Load zsh-{ccomp,wcomp} when completion is loaded
if zstyle -t ':omz:module:completion' loaded; then
init_args+=' zsh-ccomp zsh-ccomp-install zsh-wcomp zsh-wcomp-install'
fi
13 years ago
# Cache init code
fasd --init "${(z)init_args[@]}" >! "$cache_file" 2> /dev/null
fi
source "$cache_file"
unset cache_file init_args
13 years ago
13 years ago
alias j='z' # For autojump converts
alias o="a -e $aliases[o]" # Quickly open paths with open.
alias v='f -t -e vim -b viminfo' # Quickly open files with vim.
13 years ago
for keymap in 'emacs' 'viins'; do
bindkey -M "$keymap" "$key_info[Control]X$key_info[Control]A" fasd-complete # C-x C-a (files and directories)
bindkey -M "$keymap" "$key_info[Control]X$key_info[Control]D" fasd-complete-d # C-x C-d (directories)
bindkey -M "$keymap" "$key_info[Control]X$key_info[Control]F" fasd-complete-f # C-x C-f (files)
done