1
0
Fork 0
mirror of git://git.code.sf.net/p/zsh/code synced 2025-09-30 19:20:53 +02:00

zsh-workers/9199

This commit is contained in:
Tanaka Akira 2000-01-04 15:02:25 +00:00
parent bf2b2bcce7
commit 01d4ad3835
2 changed files with 44 additions and 1 deletions

View file

@ -6,7 +6,7 @@
local linepath realpath donepath prepath testpath exppath
local tmp1 tmp2 tmp3 tmp4 i orig eorig pre suf tpre tsuf opre osuf cpre
local pats haspats=no ignore group expl addpfx addsfx remsfx
local nm=$compstate[nmatches] menu match matcher mopts atmp
local nm=$compstate[nmatches] menu match matcher mopts atmp sort
typeset -U prepaths exppaths
@ -111,6 +111,37 @@ if [[ "$sopt" = - ]]; then
fi
fi
if zstyle -s ":completion${curcontext}:files" sort tmp1; then
case "$tmp1" in
*size*) sort=oL;;
*links*) sort=ol;;
*(time|date|modi)*) sort=om;;
*access*) sort=oa;;
*(inode|change)*) sort=oc;;
*) sort=on;;
esac
[[ "$tmp1" = *rev* ]] && sort[1]=O
if [[ "$sort" = on ]]; then
sort=''
else
group=( "${(@)group/#-J/-V}" )
expl=( "${(@)expl/#-J/-V}" )
tmp2=()
for tmp1 in "$pats[@]"; do
if [[ "$tmp1" = ?*\(\([^\|~]##\)\) ]]; then
tmp2=( "$tmp2[@]" "${tmp1[1,-3]}${sort}))" )
elif [[ "$tmp1" = ?*\([^\|~]##\) ]]; then
tmp2=( "$tmp2[@]" "${tmp1[1,-2]}${sort})" )
else
tmp2=( "$tmp2[@]" "${tmp1}(${sort})" )
fi
done
pats=( "$tmp2[@]" )
fi
fi
# We get the prefix and the suffix from the line and save the whole
# original string. Then we see if we will do menucompletion.

View file

@ -1101,6 +1101,18 @@ history as possible matches sort these words alphabetically instead of
keeping them in the order in which they appear in the history (from
youngest to oldest).
The completion function that generates filenames as possible matches
uses this style with the tt(files) tag to determine in which order the
names should be listed and completed when using menucompletion. The
value may be one of tt(size) to sort them by the size of the file,
tt(links) to sort them by the number of links to the file,
tt(modification) (or tt(time) or tt(date)) to sort them by the last
modification time, tt(access) to sort them by the last access time, or
tt(inode) (or tt(change)) to sort them by the last inode change
time. Any other value (or not setting this style at all) makes them be
sorted alphabetically by name. If the value contains the string
tt(reverse), sorting is done in decreasing order.
This is also used by the tt(_expand) completer. Here, if it is set to
`true', the expansions generated will always be sorted. If it is set
to tt(menu), then the expansions are only sorted when they are offered