diff options
author | Peter Stephenson <pws@users.sourceforge.net> | 2011-03-11 16:32:07 +0000 |
---|---|---|
committer | Peter Stephenson <pws@users.sourceforge.net> | 2011-03-11 16:32:07 +0000 |
commit | f2dca9e155f25ee57f15df7dc2dc81489e1abbae (patch) | |
tree | 7fcb3500f0c2c7d66b12fe3a50e92e2913d26cc7 /Functions/Chpwd/zsh_directory_name_cdr | |
parent | cc69ecfb9e10fca2d8f68100ff9f2365dedb1405 (diff) | |
download | zsh-f2dca9e155f25ee57f15df7dc2dc81489e1abbae.tar.gz zsh-f2dca9e155f25ee57f15df7dc2dc81489e1abbae.tar.xz zsh-f2dca9e155f25ee57f15df7dc2dc81489e1abbae.zip |
users/15864: turn zsh_directory_name into a hook
Diffstat (limited to 'Functions/Chpwd/zsh_directory_name_cdr')
-rw-r--r-- | Functions/Chpwd/zsh_directory_name_cdr | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/Functions/Chpwd/zsh_directory_name_cdr b/Functions/Chpwd/zsh_directory_name_cdr new file mode 100644 index 000000000..09aa35a93 --- /dev/null +++ b/Functions/Chpwd/zsh_directory_name_cdr @@ -0,0 +1,25 @@ +if [[ $1 = n ]]; then + if [[ $2 = <-> ]]; then + # Recent directory + typeset -ga reply + autoload -Uz cdr + cdr -r + if [[ -n ${reply[$2]} ]]; then + reply=(${reply[$2]}) + return 0 + else + reply=() + return 1 + fi + fi +elif [[ $1 = c ]]; then + if [[ $PREFIX = <-> || -z $PREFIX ]]; then + typeset -a keys values + values=(${${(f)"$(cdr -l)"}/ ##/:}) + keys=(${values%%:*}) + _describe -t dir-index 'recent directory index' \ + values keys -V unsorted -S']' + return + fi +fi +return 1 |