summaryrefslogtreecommitdiff
path: root/Functions/Chpwd
diff options
context:
space:
mode:
authorFrank Terbeck <ft@bewatermyfriend.org>2011-06-02 10:50:35 +0200
committerFrank Terbeck <ft@bewatermyfriend.org>2011-06-02 10:50:35 +0200
commit2438a0e95aa448f0aeda468752444306b44fe7d0 (patch)
tree8477e9c6af360f6a89af13e8cb5f2a4f9c1cff2c /Functions/Chpwd
parentb495ba1e5a3ab1396844490ad8cad17dec23d6c1 (diff)
parent21266db1d9ae433bf1dcb196a4e258c00541b599 (diff)
downloadzsh-2438a0e95aa448f0aeda468752444306b44fe7d0.tar.gz
zsh-2438a0e95aa448f0aeda468752444306b44fe7d0.zip
Merge commit 'zsh-4.3.12' into debian
Diffstat (limited to 'Functions/Chpwd')
-rw-r--r--Functions/Chpwd/.distfiles1
-rw-r--r--Functions/Chpwd/cdr2
-rw-r--r--Functions/Chpwd/zsh_directory_name_cdr25
3 files changed, 27 insertions, 1 deletions
diff --git a/Functions/Chpwd/.distfiles b/Functions/Chpwd/.distfiles
index 39ccd830c..89779a686 100644
--- a/Functions/Chpwd/.distfiles
+++ b/Functions/Chpwd/.distfiles
@@ -5,4 +5,5 @@ _cdr
chpwd_recent_add
chpwd_recent_dirs
chpwd_recent_filehandler
+zsh_directory_name_cdr
'
diff --git a/Functions/Chpwd/cdr b/Functions/Chpwd/cdr
index 3025a9d5c..4f399106b 100644
--- a/Functions/Chpwd/cdr
+++ b/Functions/Chpwd/cdr
@@ -15,7 +15,7 @@
# changing directory permanently, see below.
#
# The argument to cdr is a number corresponding to the Nth most recently
-# changed-to directory starting at 1 for the immediately preceeding
+# changed-to directory starting at 1 for the immediately preceding
# directory (the current directory is remembered but is not offered as a
# destination). You can use directory arguments if you set the
# recent-dirs-default style, see below; however, it should be noted
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