about summary refs log tree commit diff
path: root/Functions/Chpwd/zsh_directory_name_cdr
blob: cb72e46007cd511bef9a691d7905d480d0f69f64 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
if [[ $1 = n ]]; then
  if [[ $2 = <-> ]]; then
    # Recent directory
    autoload -Uz cdr
    cdr -r
    if [[ -n ${reply[$2]} ]]; then
      typeset -ga reply=(${reply[$2]})
      return 0
    else
      typeset -ga 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 -V unsorted -S']'
    return
  fi
fi
return 1