1
0
Fork 0
mirror of git://git.code.sf.net/p/zsh/code synced 2025-09-11 00:51:05 +02:00

36127: assorted minor completion function changes

This commit is contained in:
Oliver Kiddle 2015-08-12 18:02:57 +02:00
parent 4f509c6201
commit cf77e28a3f
12 changed files with 25 additions and 14 deletions

View file

@ -1,5 +1,13 @@
2015-08-12 Oliver Kiddle <opk@zsh.org> 2015-08-12 Oliver Kiddle <opk@zsh.org>
* 36127: Completion/Zsh/Context/_brace_parameter,
Completion/Unix/Command/_git, Completion/Unix/Command/_ifconfig,
Completion/Unix/Command/_kvno, Completion/Unix/Command/_mh,
Completion/Unix/Command/_rm, Completion/Unix/Command/_ssh,
Completion/Unix/Command/_stty, Completion/Unix/Command/_vim,
Completion/Unix/Type/_pdf, Completion/Unix/Command/_clay:
assorted minor completion function changes
* 36125: Src/Zle/zle_hist.c: don't set history context in get-line * 36125: Src/Zle/zle_hist.c: don't set history context in get-line
* 35834 (tweaked): Src/Zle/zle_misc.c: strip a final newline from * 35834 (tweaked): Src/Zle/zle_misc.c: strip a final newline from

View file

@ -38,5 +38,5 @@ _arguments -C \
"-e:compile and run <source> (implies -run)" \ "-e:compile and run <source> (implies -run)" \
"-M-:import <module>.*; for -e" \ "-M-:import <module>.*; for -e" \
"-v[display version info]" \ "-v[display version info]" \
":program file:_files -g '*.clay'" ":program file:_files -g '*.clay(-.)'"

View file

@ -5188,7 +5188,7 @@ _git_commands () {
local -a aliases local -a aliases
__git_extract_aliases __git_extract_aliases
local cmdtype len dup sep local cmdtype len dup sep
local -a allcmds allmatching alts disp local -a allcmds allmatching alts disp expl
zstyle -s ":completion:${curcontext}:" list-separator sep || sep=-- zstyle -s ":completion:${curcontext}:" list-separator sep || sep=--
for cmdtype in $cmdtypes aliases; do for cmdtype in $cmdtypes aliases; do
@ -5202,7 +5202,8 @@ _git_commands () {
allcmds+=( ${(P)${:-${cmdtype}_m}} ) allcmds+=( ${(P)${:-${cmdtype}_m}} )
done done
zstyle -T ":completion:${curcontext}:" verbose && disp=(-ld '${cmdtype}_d') zstyle -T ":completion:${curcontext}:" verbose && disp=(-ld '${cmdtype}_d')
compadd -O allmatching -a allcmds _description '' expl '' # get applicable matchers
compadd "$expl[@]" -O allmatching -a allcmds
len=${#${(O)allmatching//?/.}[1]} # length of longest match len=${#${(O)allmatching//?/.}[1]} # length of longest match
for cmdtype in aliases $cmdtypes; do for cmdtype in aliases $cmdtypes; do
local -a ${cmdtype}_d local -a ${cmdtype}_d

View file

@ -65,7 +65,7 @@ esac
_arguments -C "$args[@]" \ _arguments -C "$args[@]" \
'-a[apply to all interfaces]' \ '-a[apply to all interfaces]' \
'1:network interface:_net_interfaces' \ '1:network interface:_net_interfaces -r ": \t\n\-"' \
'::address family:(atalk ether inet inet6 ax25 ddp ipx netrom)' \ '::address family:(atalk ether inet inet6 ax25 ddp ipx netrom)' \
'*:option:->options' && ret=0 '*:option:->options' && ret=0

View file

@ -11,8 +11,7 @@ _arguments -C \
':principal:->principal' && ret=0 ':principal:->principal' && ret=0
if [[ $state = principal ]]; then if [[ $state = principal ]]; then
if [[ -prefix host/ ]]; then if compset -P host/; then
compset -P host/
_hosts && ret=0 _hosts && ret=0
else else
_alternative \ _alternative \

View file

@ -1,4 +1,4 @@
#compdef ali anno burst comp dist flist flists folder folders forw inc mark mhlist mhmail mhn mhparam mhpath mhshow mhstore msgchk next packf pick prev refile repl rmf rmm scan show sortm whom #compdef ali anno burst comp dist flist flists fmttest folder folders forw fnext fprev inc mark mhfixmsg mhlist mhmail mhn mhparam mhpath mhshow mhstore msgchk new next packf pick prev refile repl rmf rmm scan show sortm whom
if [[ -z $commands[mhpath] ]]; then if [[ -z $commands[mhpath] ]]; then
_message "MH commands are not available" _message "MH commands are not available"
@ -73,7 +73,9 @@ elif [[ $service = mhparam ]]; then
elif [[ $service = ali ]]; then elif [[ $service = ali ]]; then
_email_addresses -n MH _email_addresses -n MH
elif compset -P '*:'; then elif compset -P '*:'; then
_message -e number 'number of messages' _alternative \
'sequences:sub-sequence:(first last cur prev next)'
'number: : _message -e number "number of messages"'
else else
# Generate sequences. # Generate sequences.
local foldnam folddir f sequences mhneg ret=1 local foldnam folddir f sequences mhneg ret=1
@ -95,6 +97,7 @@ else
sequences=( ${${(f)"$(mark $foldnam 2>/dev/null)"}%%:*} ) sequences=( ${${(f)"$(mark $foldnam 2>/dev/null)"}%%:*} )
mhneg="$(mhparam Sequence-Negation)" && sequences=( {,$mhneg}$^sequences ) mhneg="$(mhparam Sequence-Negation)" && sequences=( {,$mhneg}$^sequences )
sequences+=( all first last prev next ) sequences+=( all first last prev next )
[[ $service = mhpath ]] && sequences+=( new )
_tags sequences _tags sequences
while _tags; do while _tags; do
while _next_label sequences expl sequence; do while _next_label sequences expl sequence; do

View file

@ -40,7 +40,7 @@ fi
local curcontext=$curcontext state line ret=1 local curcontext=$curcontext state line ret=1
declare -A opt_args declare -A opt_args
_arguments -C $opts \ _arguments -C -s $opts \
$args && ret=0 $args && ret=0
case $state in case $state in

View file

@ -105,7 +105,7 @@ _ssh () {
;; ;;
ssh-keygen) ssh-keygen)
cmds=( -p -i -e -y -c -l -B -D -U ) cmds=( -p -i -e -y -c -l -B -D -U )
_arguments \ _arguments -s \
'-q[silence ssh-keygen]' \ '-q[silence ssh-keygen]' \
"($cmds -P)-b[specify number of bits in key]:bits in key" \ "($cmds -P)-b[specify number of bits in key]:bits in key" \
"($cmds -P)-t[specify the type of the key to create]:key type:(rsa1 rsa dsa ecdsa ed25519)" \ "($cmds -P)-t[specify the type of the key to create]:key type:(rsa1 rsa dsa ecdsa ed25519)" \

View file

@ -14,5 +14,5 @@ else
parmrk inpck istrip inlcr igncr icrnl iuclc ixon ixany ixoff \ parmrk inpck istrip inlcr igncr icrnl iuclc ixon ixany ixoff \
imaxbel isig icanon xcase echo echoe echok echonl noflsh \ imaxbel isig icanon xcase echo echoe echok echonl noflsh \
tostop echoctl echoprt echoke flusho pending iexten opost \ tostop echoctl echoprt echoke flusho pending iexten opost \
olcuc onlcr ocrnl onocr onlret ofill ofdel olcuc onlcr ocrnl onocr onlret ofill ofdel raw sane
fi fi

View file

@ -1,4 +1,4 @@
#compdef vim exim gvim gex gview nvim rvim rview rgvim rgview evim eview vimdiff gvimdiff #compdef vim gvim gex gview nvim rvim rview rgvim rgview evim eview vimdiff gvimdiff
(( $+functions[_vim_files] )) || (( $+functions[_vim_files] )) ||
_vim_files () { _vim_files () {

View file

@ -1,4 +1,4 @@
#compdef pdf2dsc pdf2ps pdfimages pdfinfo pdftopbm pdftops pdftotext pdfopt pdffonts kpdf apvlv epdfview #compdef pdf2dsc pdf2ps pdfimages pdfinfo pdftopbm pdftops pdftotext pdfopt pdffonts kpdf apvlv epdfview mupdf
local expl ext='' local expl ext=''

View file

@ -152,7 +152,7 @@ if [[ $PREFIX = *'${('[^\)]# ]]; then
"F:join arrays with newlines" "F:join arrays with newlines"
"g:process echo array sequences (needs options)" "g:process echo array sequences (needs options)"
"i:sort case-insensitively" "i:sort case-insensitively"
"k:subsitute keys of associative arrays" "k:substitute keys of associative arrays"
"L:lower case all letters" "L:lower case all letters"
"n:sort decimal integers numerically" "n:sort decimal integers numerically"
"o:sort in ascending order (lexically if no other sort option)" "o:sort in ascending order (lexically if no other sort option)"