improved z.sh a bit
This commit is contained in:
parent
1e620361e1
commit
f13d71d44f
1 changed files with 10 additions and 7 deletions
17
yash/z.sh
17
yash/z.sh
|
@ -8,22 +8,25 @@ _z_exec() {
|
|||
return $?
|
||||
}
|
||||
|
||||
_z_completions() {
|
||||
complete $(_z_exec "select alias from jump_list order by alias")
|
||||
}
|
||||
|
||||
function completion/z {
|
||||
OPTIONS=( #>#
|
||||
"h:; show help text"
|
||||
"l:; list aliases"
|
||||
"a:; add a new alias"
|
||||
array OPTIONS \
|
||||
"h:; show help text" \
|
||||
"l:; list aliases" \
|
||||
"a:; add a new alias" \
|
||||
"r:; remove alias"
|
||||
) #<#
|
||||
|
||||
command -f completion//parseoptions -n
|
||||
argnum="${WORDS[#]}"
|
||||
if [ "$ARGOPT" = "-" ] && [ "$argnum" -eq 1 ]; then
|
||||
command -f completion//completeoptions
|
||||
elif [ -z "$ARGOPT" ] && [ "$argnum" -eq 1 ]; then
|
||||
complete -T $(_z_exec "select alias from jump_list")
|
||||
_z_completions
|
||||
elif [ "$ARGOPT" = "r" ] && [ "$argnum" -eq 2 ]; then
|
||||
complete -T $(_z_exec "select alias from jump_list")
|
||||
_z_completions
|
||||
elif [ "${WORDS[2]}" = "-a" ] && [ "$argnum" -eq 3 ]; then
|
||||
complete -T -S '/' -d
|
||||
fi
|
||||
|
|
Loading…
Add table
Reference in a new issue