|
1 | 1 | #!/bin/zsh
|
2 |
| -: ${_FASD_INIT_CACHE:=${ZSH_CACHE_DIR:-${ZDOTDIR:-$HOME}}/.fasd-init} |
| 2 | +# |
| 3 | +# ZSH-style plugin for `fasd`. |
| 4 | +# Allows this repo to be used by any ZSH plugin manager. |
| 5 | +# |
| 6 | +# You may want to add some of the following to your .zshrc: |
| 7 | +# |
| 8 | +# alias v="f -e $EDITOR" |
| 9 | +# alias v='f -t -e vim -b viminfo' |
| 10 | +# alias o='a -e open_command' |
| 11 | +# |
| 12 | +# bindkey '^X^A' fasd-complete # C-x C-a to do fasd-complete (files and directories) |
| 13 | +# bindkey '^X^F' fasd-complete-f # C-x C-f to do fasd-complete-f (only files) |
| 14 | +# bindkey '^X^D' fasd-complete-d # C-x C-d to do fasd-complete-d (only directories) |
| 15 | +# |
| 16 | +: ${_FASD_INIT_CACHE:=${ZSH_CACHE_DIR:-${ZDOTDIR:-$HOME}}/.fasd-init.zsh} |
3 | 17 |
|
4 |
| -path+=($0:h) |
5 |
| -manpath+=($0:h) |
| 18 | +fpath+=($0:h/fasd.plugin/bin) |
| 19 | +manpath+=($0:h/fasd.plugin/man) |
6 | 20 |
|
7 |
| -if [ "${commands[fasd]}" -nt "$_FASD_INIT_CACHE" -o ! -s "$_FASD_INIT_CACHE" ]; then |
8 |
| - fasd --init \ |
9 |
| - posix-alias \ |
10 |
| - zsh-hook \ |
11 |
| - zsh-ccomp zsh-ccomp-install \ |
12 |
| - zsh-wcomp zsh-wcomp-install \ |
13 |
| - >| "$_FASD_INIT_CACHE" |
14 |
| -fi |
15 |
| -source "$_FASD_INIT_CACHE" |
16 |
| - |
17 |
| -#alias v="f -e $EDITOR" |
18 |
| -#alias v='f -t -e vim -b viminfo' |
19 |
| -#alias o='a -e open_command' |
| 21 | +emulate sh -c 'autoload -U fasd' |
20 | 22 |
|
21 |
| -#bindkey '^X^A' fasd-complete # C-x C-a to do fasd-complete (files and directories) |
22 |
| -#bindkey '^X^F' fasd-complete-f # C-x C-f to do fasd-complete-f (only files) |
23 |
| -#bindkey '^X^D' fasd-complete-d # C-x C-d to do fasd-complete-d (only directories) |
| 23 | +if [ $0:h/fasd -nt $_FASD_INIT_CACHE -o ! -s $_FASD_INIT_CACHE ]; then |
| 24 | + fasd --init \ |
| 25 | + posix-alias \ |
| 26 | + zsh-hook \ |
| 27 | + zsh-ccomp zsh-ccomp-install \ |
| 28 | + zsh-wcomp zsh-wcomp-install \ |
| 29 | + >| "$_FASD_INIT_CACHE" |
| 30 | +fi |
| 31 | +source $_FASD_INIT_CACHE |
0 commit comments