mirror of
git://git.code.sf.net/p/zsh/code
synced 2025-10-25 17:20:25 +02:00
Initial revision
This commit is contained in:
parent
02801e27d5
commit
a0402f795d
1 changed files with 38 additions and 0 deletions
38
Completion/User/_tilde_files
Normal file
38
Completion/User/_tilde_files
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
#autoload
|
||||
|
||||
# Complete files and expand tilde expansions in it.
|
||||
|
||||
if (( $argv[(I)-W*] )); then
|
||||
_files "$@"
|
||||
return
|
||||
fi
|
||||
|
||||
case "$PREFIX" in
|
||||
\~/*)
|
||||
IPREFIX="${IPREFIX}${HOME}/"
|
||||
PREFIX="${PREFIX[3,-1]}"
|
||||
_files "$@" -W "${HOME}"
|
||||
;;
|
||||
\~*/*)
|
||||
local user="${PREFIX[2,-1]%%/*}"
|
||||
|
||||
if (( $+userdirs[$user] )); then
|
||||
user="$userdirs[$user]"
|
||||
elif (( $+nameddirs[$user] )); then
|
||||
user="$nameddirs[$user]"
|
||||
else
|
||||
_message "unknown user \`$user'"
|
||||
return 1
|
||||
fi
|
||||
IPREFIX="${IPREFIX}${user%/}/"
|
||||
PREFIX="${PREFIX#*/}"
|
||||
_files "$@" -W "$user"
|
||||
;;
|
||||
\~*)
|
||||
compset -P '?'
|
||||
_users "$@"
|
||||
;;
|
||||
*)
|
||||
_files "$@"
|
||||
;;
|
||||
esac
|
||||
Loading…
Add table
Add a link
Reference in a new issue