mirror of
git://git.code.sf.net/p/zsh/code
synced 2025-01-01 05:16:05 +01:00
Initial revision
This commit is contained in:
parent
59c3d242d5
commit
347fab44e0
5 changed files with 82 additions and 0 deletions
1
Completion/.cvsignore
Normal file
1
Completion/.cvsignore
Normal file
|
@ -0,0 +1 @@
|
|||
Makefile
|
50
Completion/User/_gdb
Normal file
50
Completion/User/_gdb
Normal file
|
@ -0,0 +1,50 @@
|
|||
#compdef gdb
|
||||
|
||||
# This uses the configuration keys `ps_args' and `ps_listargs'
|
||||
# described in the `_wait' function.
|
||||
|
||||
local cur="$words[CURRENT]" prev w list ret=1
|
||||
|
||||
_long_options -t '*=(CORE|SYM)FILE' '_files' \
|
||||
'*=EXECFILE' '_files *(*)' \
|
||||
'*=TTY' 'compadd /dev/tty*' && return 0
|
||||
|
||||
if compset -P '-(cd|directory)='; then
|
||||
_files -/
|
||||
elif compset -P '-tty='; then
|
||||
compadd - /dev/tty*
|
||||
elif compset -P '-(exec|se)='; then
|
||||
_files -/g '*(*)'
|
||||
elif compset -P '-(symbols|core|command)='; then
|
||||
_files
|
||||
elif compset -P -; then
|
||||
compadd -QS '' - symbols\= exec\= se\= core\= command\= directory\= \
|
||||
cd\= tty\=
|
||||
compadd - help h s e c x d nx n quiet q batch fullname f b
|
||||
else
|
||||
prev="$words[CURRENT-1]"
|
||||
|
||||
case "$prev" in
|
||||
(-d) _files -/ && return 0 ;;
|
||||
(-e) _files -/g '*(*)' && return 0 ;;
|
||||
(-[csx]) _files && return 0 ;;
|
||||
(-b) compadd -V baud 0 50 75 110 134 150 200 300 600 1200 1800 2400 4800 \
|
||||
9600 19200 38400 57600 115200 230400 && return 0 ;;
|
||||
esac
|
||||
w=( "${(@)words[2,-1]}" )
|
||||
while [[ "$w[1]" = -* ]]; do
|
||||
[[ "$w[1]" = -[decsxb] ]] && shift 1 w
|
||||
shift 1 w
|
||||
done
|
||||
|
||||
if [[ $#w -gt 1 ]]; then
|
||||
_files && ret=0
|
||||
list=("${(F)${(@Mr:COLUMNS-1:)${(f)$(ps ${compconfig[ps_listargs]:-$compconfig[ps_args]} 2>/dev/null)}[2,-1]:#[ ]#${PREFIX}[0-9]#${SUFFIX}[ ]*${w[1]:t}}}
|
||||
")
|
||||
compadd -y list - ${${${(M)${(f)"$(ps $compconfig[ps_args] 2>/dev/null)"}:#*${w[1]:t}*}## #}%% *} && ret=0
|
||||
|
||||
return ret
|
||||
else
|
||||
_files -/g '*(*)'
|
||||
fi
|
||||
fi
|
8
Completion/User/_sh
Normal file
8
Completion/User/_sh
Normal file
|
@ -0,0 +1,8 @@
|
|||
#compdef sh ksh bash zsh csh tcsh rc
|
||||
|
||||
if (( CURRENT == ${words[(i)-c]} + 1 )); then
|
||||
compset -q
|
||||
_normal
|
||||
else
|
||||
_default
|
||||
fi
|
22
Completion/User/_su
Normal file
22
Completion/User/_su
Normal file
|
@ -0,0 +1,22 @@
|
|||
#compdef su
|
||||
|
||||
local shell comp name usr base
|
||||
|
||||
[[ $words[2] != - ]]
|
||||
(( base=$?+2 ))
|
||||
|
||||
if [[ CURRENT -eq base ]]; then
|
||||
compgen -u && return
|
||||
usr=root
|
||||
elif [[ CURRENT -ge base+1 ]]; then
|
||||
usr=$words[base]
|
||||
else
|
||||
return
|
||||
fi
|
||||
|
||||
shell=${"$(egrep "^$usr:" </etc/passwd)"##*:}
|
||||
compset -n $base
|
||||
for name in $shell $shell:t -default-; do
|
||||
comp="$_comps[$name]"
|
||||
[[ ! -z "$comp" ]] && "$comp" && return
|
||||
done
|
1
Functions/.cvsignore
Normal file
1
Functions/.cvsignore
Normal file
|
@ -0,0 +1 @@
|
|||
Makefile
|
Loading…
Reference in a new issue