From 229bc3cc74bfa8d6c23a02a3e0e89d7f08467dd1 Mon Sep 17 00:00:00 2001 From: "Barton E. Schaefer" Date: Sat, 6 Jun 2015 12:31:47 -0700 Subject: 35350: extend "fc -I" to cover listing of "internal" history events only --- Completion/Zsh/Command/_fc | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) (limited to 'Completion/Zsh/Command') diff --git a/Completion/Zsh/Command/_fc b/Completion/Zsh/Command/_fc index c2987211e..15892440b 100644 --- a/Completion/Zsh/Command/_fc +++ b/Completion/Zsh/Command/_fc @@ -12,8 +12,10 @@ words=( "${(@)words[1,CURRENT-1]:#*=*}" "${(@)words[CURRENT,-1]}" ) fc_common=( -s -S - '(-A -R -W -I -p -P)-r[reverse order of the commands]' - '(-A -R -W -I -e -p -P)-n[suppress line numbers]' + '(-A -R -W -p -P)-I[include internal (new) events only]' + '(-A -R -W -p -P)-L[include local events only]' + '(-A -R -W -p -P)-r[reverse order of the events]' + '(-A -R -W -e -p -P)-n[suppress line numbers]' ) if [[ -n ${words[(r)-[pa](|[ap])]} ]]; then @@ -32,20 +34,20 @@ else fi fc_hist=( - '(-A -R -W -I -a -p -P 2)-m[treat argument as a pattern]' - '(-A -R -W -I -e -f -E -i -t -a -p -P)-d[print time-stamps]' - '(-A -R -W -I -e -d -E -i -t -a -p -P)-f[mm/dd/yyyy format time-stamps]' - '(-A -R -W -I -e -d -f -i -t -a -p -P)-E[dd.mm.yyyy format time-stamps]' - '(-A -R -W -I -e -d -f -E -t -a -p -P)-i[yyyy-mm-dd format time-stamps]' - '(-A -R -W -I -e -d -f -E -i -a -p -P)-t[print time-stamps in specified format]:date format' - '(-A -R -W -I -e -a -p -P)-D[print elapsed times]' + '(-A -R -W -a -p -P 2)-m[treat argument as a pattern]' + '(-A -R -W -e -f -E -i -t -a -p -P)-d[print time-stamps]' + '(-A -R -W -e -d -E -i -t -a -p -P)-f[mm/dd/yyyy format time-stamps]' + '(-A -R -W -e -d -f -i -t -a -p -P)-E[dd.mm.yyyy format time-stamps]' + '(-A -R -W -e -d -f -E -t -a -p -P)-i[yyyy-mm-dd format time-stamps]' + '(-A -R -W -e -d -f -E -i -a -p -P)-t[print time-stamps in specified format]:date format' + '(-A -R -W -e -a -p -P)-D[print elapsed times]' '(-A -R -W -I -e -d -f -i -l -m -n -r -D -E -t -P)-a[with -p, automatically pop history on function return]' '(-A -R -W -I -e -d -f -i -l -m -n -r -D -E -t -P)-p[push current history to stack]' '(- *)-P[pop history from stack]' ) -fc_r='(-A -R -W -I -e)-l[list resulting commands on stdout]' +fc_r='(-A -R -W -e)-l[list resulting commands on stdout]' case $service in history) @@ -56,12 +58,11 @@ case $service in ;; *) _arguments "$fc_common[@]" "$fc_hist[@]" "$fc_r" \ - '(-A -R -W -I -a -l -n -d -f -E -i -r -t -D -p -P)-e+[specify editor to invoke]:editor to invoke:_command_names -e' \ - '(-a -l -m -e -r -n -d -f -t -E -i -R -D -A -W -p -P *)-'{\ + '(-A -R -W -a -l -n -d -f -E -i -r -t -D -p -P)-e+[specify editor to invoke]:editor to invoke:_command_names -e' \ + '(-a -l -L -m -e -r -n -d -f -t -E -i -R -D -A -W -p -P *)-'{\ 'R[read history from file]',\ 'A[append history to file]',\ -'W[write history to file]',\ -'I[read/write new events only]'} && ret=0 +'W[write history to file]'} && ret=0 ;; esac -- cgit v1.2.3 From b2de9b518e54c73b2832ad8e24d536f5c05be985 Mon Sep 17 00:00:00 2001 From: Oliver Kiddle Date: Fri, 19 Jun 2015 19:54:44 +0200 Subject: 35527: use list-separator style in cases where separator was hardcoded --- ChangeLog | 4 ++++ Completion/Unix/Type/_email_addresses | 5 +++-- Completion/Zsh/Command/_fc | 19 +++++++++---------- Completion/Zsh/Command/_zpty | 7 ++++--- 4 files changed, 20 insertions(+), 15 deletions(-) (limited to 'Completion/Zsh/Command') diff --git a/ChangeLog b/ChangeLog index 0151d9946..16daaab8e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,9 @@ 2015-06-19 Oliver Kiddle + * 35527: Completion/Unix/Type/_email_addresses, + Completion/Zsh/Command/_fc, Completion/Zsh/Command/_zpty: + use list-separator style in cases where separator was hardcoded + * 35528: Completion/Unix/Type/_pids: allow for IPREFIX 2015-06-18 Oliver Kiddle diff --git a/Completion/Unix/Type/_email_addresses b/Completion/Unix/Type/_email_addresses index 926e8b4e3..7d5c942de 100644 --- a/Completion/Unix/Type/_email_addresses +++ b/Completion/Unix/Type/_email_addresses @@ -88,7 +88,7 @@ _email-local() { _email_addresses() { local -a plugins reply list args local -A opts files - local plugin rcfile muttrc expl ret fret + local plugin rcfile muttrc expl sep ret fret local __specialx='][()<>@,;:\\".' local __spacex=" " # Space, tab @@ -159,7 +159,8 @@ _email_addresses() { if (( fret == 300 )); then if (( ! $+opts[-c] )) && [[ $opts[-n] = $plugin ]]; then - zformat -a list ' -- ' "${reply[@]}" + zstyle -s ":completion:${curcontext}:$curtag" list-separator sep || sep=-- + zformat -a list " $sep " "${reply[@]}" _wanted mail-aliases expl 'alias' compadd "$@" \ -d list - ${reply%%:*} && ret=0 else diff --git a/Completion/Zsh/Command/_fc b/Completion/Zsh/Command/_fc index 15892440b..68456cc3d 100644 --- a/Completion/Zsh/Command/_fc +++ b/Completion/Zsh/Command/_fc @@ -1,7 +1,7 @@ #compdef fc history r local curcontext="$curcontext" state state_descr line ret=1 -local list events num cmd +local events num cmd sep typeset -A opt_args local fc_common fc_hist fc_r @@ -67,21 +67,20 @@ case $service in esac if [[ -n $state ]]; then + zstyle -s ":completion:${curcontext}:" list-separator sep || sep=-- if [[ -z ${line:#*=*} ]] && compset -P '*='; then _message -e replacements 'replacement' elif [[ -prefix [0-9] ]]; then - events=( ${(ps.\0.)"$(printf '%s:%s\0' ${(kv)history})"} ) - zformat -a list " -- " "$events[@]" - _wanted -2V events expl "$state_descr" compadd -M "B:0=" -ld list - \ - "${events[@]%%:*}" + events=( ${(0)"$(printf "%-${#HISTNO}.${#HISTNO}s $sep %s\0" "${(kv)history[@]}")"} ) + _wanted -2V events expl "$state_descr" compadd -M "B:0=" -ld events - \ + "${events[@]%% *}" elif [[ -prefix - ]]; then - for num cmd in ${(kv)history}; do + for num cmd in "${(kv@)history}"; do (( num=num - HISTNO )) - events+=( $num:$cmd ) + events+=( "${(r.1+$#HISTNO.)num} $sep $cmd" ) done - zformat -a list " -- " "$events[@]" - _wanted -2V events expl "$state_descr" compadd -ld list - \ - "${events[@]%%:*}" + _wanted -2V events expl "$state_descr" compadd -ld events - \ + "${events[@]%% *}" else _wanted events expl "$state_descr" compadd -S '' - \ ${${history%%[=[:IFS:]]*}:#[0-9-]*} || _guard "[0-9]#" event diff --git a/Completion/Zsh/Command/_zpty b/Completion/Zsh/Command/_zpty index ef4ac4bb1..99251aa0a 100644 --- a/Completion/Zsh/Command/_zpty +++ b/Completion/Zsh/Command/_zpty @@ -1,6 +1,6 @@ #compdef zpty -local state line list names expl curcontext="$curcontext" +local state line list names expl sep curcontext="$curcontext" typeset -A opt_args _arguments -C -s -S \ @@ -50,8 +50,9 @@ if [[ $state = name ]]; then fi list=( ${${(f)"$(zpty)"}#*\) } ) names=( ${list%%:*} ) - if zstyle -T ":completion:${curcontext}" verbose; then - zformat -a list ' --' ${${(f)"$(zpty)"}#*\) } + if zstyle -T ":completion:${curcontext}:" verbose; then + zstyle -s ":completion:${curcontext}:" list-separator sep || sep=-- + zformat -a list " $sep" ${${(f)"$(zpty)"}#*\) } _wanted names expl 'zpty command name' compadd -d list -a names else _wanted names expl 'zpty command name' compadd -a names -- cgit v1.2.3 From 5c5654016be8739c22d0959a2a328202a2c7a5e8 Mon Sep 17 00:00:00 2001 From: Oliver Kiddle Date: Wed, 8 Jul 2015 12:16:32 +0200 Subject: 35729: new compadd completion --- ChangeLog | 2 ++ Completion/Zsh/Command/_compadd | 52 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 54 insertions(+) create mode 100644 Completion/Zsh/Command/_compadd (limited to 'Completion/Zsh/Command') diff --git a/ChangeLog b/ChangeLog index 86da9fccb..b4a31773e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,7 @@ 2015-07-08 Oliver Kiddle + * 35729: Completion/Zsh/Command/_compadd: new compadd completion + * Matthew Martin: 35727: Completion/Unix/Type/_diff_options: support OpenBSD for diff options diff --git a/Completion/Zsh/Command/_compadd b/Completion/Zsh/Command/_compadd new file mode 100644 index 000000000..03fed1854 --- /dev/null +++ b/Completion/Zsh/Command/_compadd @@ -0,0 +1,52 @@ +#compdef compadd + +local curcontext="$curcontext" state line ret=1 +typeset -A opt_args + +_arguments -C -s -S -A "-*" \ + '-P+[specify prefix]:prefix' \ + '-S+[specify suffix]:suffix' \ + '-p+[specify hidden prefix]:hidden prefix' \ + '-s+[specify hidden suffix]:hidden suffix' \ + '-i+[specify ignored prefix]:ignored prefix' \ + '-I+[specify ignored suffix]:ignored suffix' \ + '(-k)-a[matches are elements of specified arrays]' \ + '(-a)-k[matches are keys of specified associative arrays]' \ + '-d+[specify display strings]:array:_parameters -g "*array*"' \ + '-l[list display strings one per line, not in columns]' \ + '-o[order matches by display string not by match string]' \ + '(-1 -E)-J+[specify match group]:group' \ + '-V+[specify unsorted match group]:group' \ + '(-J -E)-1[remove only consecutive duplicates from group]' \ + '-2[preserve all duplicates]' \ + '(-x)-X[specify explanation]:explanation' \ + '(-X)-x[specify unconditional explanation]:explanation' \ + '-q[make suffix autoremovable]' \ + '-r+[specify character class for suffix autoremoval]:character class' \ + '-R+[specify function for suffix autoremoval]:function:_functions' \ + '-f[mark matches as being files]' \ + '-e[mark matches as being parameters]' \ + '-W[specify location for matches marked as files]' \ + '-F+[specify array of ignore patterns]:array:_parameters -g "*array*"' \ + '-Q[disable quoting of matchines]' \ + '*-M[specify matching specifications]' \ + '-n[hide matches in completion listing]' \ + '-U[disable internal matching of completion candidates]' \ + '-O+[populate array with matches instead of adding them]:array:_parameters -g "*array*"' \ + '-A+[populate array with expanded matches instead of adding them]:array:_parameters -g "*array*"' \ + '-D+[delete elements from array corresponding to non-matching candidates]:array:_parameters -g "*array*"' \ + '-C[add special match that expands to all other matches]' \ + '(-1 -J)-E+[add specified number of display only matches]:number' \ + '*:candidate:->candidates' && ret=0 + +if [[ -n $state ]]; then + if (( $+opt_args[-a] )); then + _parameters -g "*array*" && ret=0 + elif (( $+opt_args[-k] )); then + _parameters -g "*assoc*" && ret=0 + else + _message -e candidate candidates + fi +fi + +return ret -- cgit v1.2.3 From 5951ac13ed0fee0352a6bfcbcc78ea8c0ec8ad5f Mon Sep 17 00:00:00 2001 From: Oliver Kiddle Date: Thu, 9 Jul 2015 14:58:06 +0200 Subject: 35748: fixes to prompt spec completion where it contains date formats --- ChangeLog | 6 +- Completion/Unix/Type/_ps1234 | 134 ----------------------------------- Completion/Zsh/Command/_print | 17 +++-- Completion/Zsh/Type/_ps1234 | 157 ++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 173 insertions(+), 141 deletions(-) delete mode 100644 Completion/Unix/Type/_ps1234 create mode 100644 Completion/Zsh/Type/_ps1234 (limited to 'Completion/Zsh/Command') diff --git a/ChangeLog b/ChangeLog index fb201d8a7..5dcc1e266 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,9 @@ 2015-07-09 Oliver Kiddle + * 35748: Completion/Zsh/Type/_ps1234, + Completion/Zsh/Command/_print: fixes to prompt spec completion + where it contains date formats + * 35749: (c.f. Jun T: 35732): Completion/Unix/Type/_date_formats: fix exclusion list for flags/modifiers @@ -34,7 +38,7 @@ 2015-07-06 Oliver Kiddle - * 35704: Doc/Zsh/compwid.yo, Src/Zle/compcore.c, Src/Zle/complete.c; + * 35704: Doc/Zsh/compwid.yo, Src/Zle/compcore.c, Src/Zle/complete.c: compadd -E 0 should imply -J and -2 2015-07-06 Mikael Magnusson diff --git a/Completion/Unix/Type/_ps1234 b/Completion/Unix/Type/_ps1234 deleted file mode 100644 index b9e516628..000000000 --- a/Completion/Unix/Type/_ps1234 +++ /dev/null @@ -1,134 +0,0 @@ -#compdef -value-,PROMPT,-default- -value-,PROMPT2,-default- -value-,PROMPT3,-default- -value-,PROMPT4,-default- -value-,RPROMPT,-default- -value-,RPROMPT2,-default- -value-,PS1,-default- -value-,PS2,-default- -value-,PS3,-default- -value-,PS4,-default- -value-,RPS1,-default- -value-,RPS2,-default- -value-,SPROMPT,-default- - -local -a specs -local expl bs - -if [[ -z $compstate[quote] ]]; then - bs='\' -fi - -if [[ $PREFIX == *%D$bs\{[^($bs\})]# ]]; then - _date_formats zsh -elif [[ $PREFIX == *%(-|)<-># ]]; then - specs=( - 'm:hostname up to first .' - '_:status of parser' - 'd:current working directory' - '/:current working directory' - '~:current working directory, with ~ replacement' - 'N:name of current script or shell function' - 'x:name of file containing code being executed' - 'c:deprecated' - '.:deprecated' - 'C:deprecated' - 'F:start using fg color' - 'K:start using bg color' - 'G:counts as extra character inside %{...%}' - ) - if [[ $PREFIX == *% ]]; then - if [[ $service == -value-,SPROMPT,* ]]; then - specs+=( - 'r:suggested correction' - 'R:corrected string' - ) - fi - specs+=( - '%:A %' - '):A )' - 'l:current line (tty) with /dev/tty stripped' - 'M:full hostname' - 'n:username' - 'y:current line (tty)' - '#:a # when root, % otherwise' - '?:return status of last command' - 'h:current history event number' - '!:current history event number' - 'i:current line number' - 'I:current source line number' - 'j:number of jobs' - 'L:$SHLVL' - 'D:date in yy-mm-dd format' - 'T:current time of day, 24-hour format' - 't:current time of day, 12-hour am/pm format' - '@:current time of day, 12-hour am/pm format' - '*:current time of day, 24-hour format with seconds' - 'w:the date in day-dd format' - 'W:the date in mm/dd/yy format' - 'D{:format string like strftime' - 'B:start bold' - 'b:stop bold' - 'E:clear to end of line' - 'U:start underline' - 'u:stop underline' - 'S:start standout' - 's:stop standout' - 'f:reset fg color' - 'k:reset bg color' - '{:start literal escape sequence' - '}:stop literal escape sequence' - 'v:value from $psvar array' - '(:ternary expression %(x.true-string.false-string)' - '<<:truncation from left %len>:truncation from right %len>string>' - '[]:truncation from who knows where' - ) - fi - compset -P "*" - _describe -t prompt-format-specifier 'prompt format specifier' specs -S '' - _message -e prompt-format-specifier number -elif [[ $PREFIX == *%$bs\((-|)<-># ]]; then - specs=( - '!:running with privileges' - '#:effective uid' - '?:exit status' - '_:at least n shell constructs started' - 'C:at least n path elements' - '/:at least n path elements' - '.:at least n path elements' - 'c:at least n path elements' - '~:at least n path elements' - 'D:month' - 'd:day of month' - 'g:effective gid' - 'j:number of jobs' - 'L:SHLVL' - 'l:number of characters already printed' - 'S:SECONDS parameter at least n' - 'T:current hour' - 't:current minute' - 'v:psvar has at least n elements' - 'V:element n of psvar is set and non-empty' - 'w:day of week (Sunday = 0)' - ) - compset -P "*" - _describe -t ternary-prompt-expression 'ternary prompt format test character' specs -S '' - _message -e ternary-prompt-expression number -elif [[ $PREFIX == *%[FK]$bs\{[0-9a-z]# ]]; then - specs=( - black - red - green - yellow - blue - magenta - cyan - white - default - ) - compset -P "*{" - _describe -t ansi-color-name 'ansi color' specs -S $bs\} - if compset -P "<->"; then - _wanted ansi-color-number expl 'close brace' compadd -S '' \} - else - _message -e ansi-color-number "number between 0 and $(( $terminfo[colors] - 1 ))" - fi -else - _default "$@" - specs=(%) - if compset -P "*%D"; then - specs+=(\{) - else - compset -P "*" - fi - _describe -t prompt-format-specifier 'prompt format specifier' specs -S '' -fi diff --git a/Completion/Zsh/Command/_print b/Completion/Zsh/Command/_print index 405393355..1eba13e88 100644 --- a/Completion/Zsh/Command/_print +++ b/Completion/Zsh/Command/_print @@ -11,7 +11,7 @@ if [[ $service = print ]]; then pflag='(-s -u -z)-p[print arguments to input of coprocess]' if [[ -n ${words[1,CURRENT][(r)-*P*]} ]]; then - rest='*: :_ps1234' + rest='*: :->prompt' else rest='*: :_default' fi @@ -48,16 +48,17 @@ if [[ $state = printf ]]; then fi if [[ $state = printfformat ]]; then - if [[ ${(Q)PREFIX} = *%((-|)<->|[-#0 +*.])# ]]; then + if [[ ${(Q)PREFIX} = *%[0-9\$#\ +*.\'-]# ]]; then local -a specs specs=( '#:alternate form' - '0:zeropad to length n' + '0:zero pad to length' '-:left adjust result' ' :leave one space in front of positive number from signed conversion' '+:always place sign before a number from signed conversion' '*:field width in next argument' '.:precision' + "':thousand separators" 'c:print the first character of the argument' 's:print the argument as a string' {d,i}':signed decimal number or with leading " numeric value of following character' @@ -73,12 +74,16 @@ if [[ $state = printfformat ]]; then 'q:as %s but shell quote result' ) compset -P "*" - _describe -t print-format-specifier 'print format specifier' specs -S '' - _message -e print-format-specifier 'number' + _describe -t print-format-specifiers 'print format specifier' specs -S '' + _message -e print-format-specifiers 'number' else - _describe -t print-format-specifier 'print format specifier' '(%)' -S '' + _wanted print-format-specifiers expl 'print format specifier' compadd -S '' % fi ret=0 +elif [[ $state = prompt ]]; then + _default && ret=0 + # complete prompt specifiers without interfering too much with default completion + (( $#compstate[unambiguous] <= $#PREFIX || ! $#PREFIX )) && _ps1234 && ret=0 fi return ret diff --git a/Completion/Zsh/Type/_ps1234 b/Completion/Zsh/Type/_ps1234 new file mode 100644 index 000000000..8d3c5d861 --- /dev/null +++ b/Completion/Zsh/Type/_ps1234 @@ -0,0 +1,157 @@ +#compdef -value-,PROMPT,-default- -value-,PROMPT2,-default- -value-,PROMPT3,-default- -value-,PROMPT4,-default- -value-,RPROMPT,-default- -value-,RPROMPT2,-default- -value-,PS1,-default- -value-,PS2,-default- -value-,PS3,-default- -value-,PS4,-default- -value-,RPS1,-default- -value-,RPS2,-default- -value-,SPROMPT,-default- + +local -a specs +local expl bs suf pre changed=1 ret=1 + +if [[ -z $compstate[quote] ]]; then + bs='\' # in patterns we use (\\|) widely as print -P handles backslashes first +fi + +# first strip off any complete prompt specifications leaving only the +# current, incomplete, one +while (( changed )); do + changed=0 + compset -P '%[DFK](\\|){[^}]#}' && changed=1 # formats with arg: %x{...} + compset -P '%[0-9-\\]#[^DFK(0-9-<>\\\[]' && changed=1 # normal formats + compset -P '%[0-9-\\]#(<[^<]#<|>[^>]#>|\[[^\]]#\])' && changed=1 # truncations + compset -P '%[0-9-\\]#(\\|)\(??|[^%]' && changed=1 # start of ternary + compset -P '[^%]##' && changed=1 # sundry other characters + # %D/%F/%K without a following { ... } + [[ $PREFIX = %(-|)<->#[DFK](\\|)[^{\\]* ]] && + compset -P '%[0-9\\-]#[DFK]' && changed=1 +done +[[ $PREFIX = %(-|)<->[FK](#e) ]] && compset -P '*' # F/K with number + +if compset -P '%[FK]'; then + # this should use -P but that somehow causes single quotes to be stripped + compset -P '(\\|){' || pre=( -p "$bs{" ) + compset -S '(\\|)}*' || suf=( -S $bs\} ) + specs=( + black + red + green + yellow + blue + magenta + cyan + white + default + ) + _wanted ansi-colors expl 'ansi color' compadd $suf $pre -a specs && ret=0 + if (( $#suf )) && compset -P "<->"; then + _wanted ansi-colors expl 'closing brace' compadd -S '' \} && ret=0 + else + _message -e terminal-colors "number between 0 and $(( $terminfo[colors] - 1 ))" + fi +fi + +if compset -P '%[0-9-\\]#\(?'; then + compset -S '*' + _delimiters && ret=0 +elif compset -P '%[0-9-\\]#[<>\]]'; then + _message -e replacements 'replacement string' +elif compset -P '%[0-9-\\]#(\\|)\('; then + compset -S '[.:+/-%]*' || suf=( -S . ) + compset -S '*' + specs=( + '!:running with privileges' + '#:effective uid' + '?:exit status' + '_:at least n shell constructs started' + 'C:at least n path elements' + '/:at least n path elements' + '.:at least n path elements' + 'c:at least n path elements' + '~:at least n path elements' + 'D:month' + 'd:day of month' + 'g:effective gid' + 'j:number of jobs' + 'L:SHLVL' + 'l:number of characters already printed' + 'S:SECONDS parameter at least n' + 'T:current hour' + 't:current minute' + 'v:psvar has at least n elements' + 'V:element n of psvar is set and non-empty' + 'w:day of week (Sunday = 0)' + ) + _describe -t ternary-prompt-expressions 'ternary prompt format test character' specs $suf && ret=0 +elif compset -P '%D(\\|){'; then + compset -S '(\\|)}*' + _date_formats zsh && ret=0 +elif [[ -prefix '%' ]] || + ! zstyle -t ":completion:${curcontext}:prompt-format-specifiers" prefix-needed +then + specs=( + 'm:hostname up to first .' + '_:status of parser' + '^:reversed status of parser' + 'd:current working directory' + '/:current working directory' + '~:current working directory, with ~ replacement' + 'N:name of current script or shell function' + 'x:name of file containing code being executed' + 'c:deprecated' + '.:deprecated' + 'C:deprecated' + 'F:start using fg color' + 'K:start using bg color' + 'G:counts as extra character inside %{...%}' + '(:ternary expression %(x.true-string.false-string)' + ) + compset -P '%' || pre=( -p '%' ) + if ! compset -P '(-|)<->'; then + if [[ $service == -value-,SPROMPT,* ]]; then + specs+=( + 'r:suggested correction' + 'R:corrected string' + ) + fi + specs+=( + '%:A %' + '):A )' + 'l:current line (tty) with /dev/tty stripped' + 'M:full hostname' + 'n:username' + 'y:current line (tty)' + '#:a # when root, % otherwise' + '?:return status of last command' + 'h:current history event number' + '!:current history event number' + 'i:current line number' + 'I:current source line number' + 'j:number of jobs' + 'L:$SHLVL' + 'D:date in yy-mm-dd format' + 'T:current time of day, 24-hour format' + 't:current time of day, 12-hour am/pm format' + '@:current time of day, 12-hour am/pm format' + '*:current time of day, 24-hour format with seconds' + 'w:the date in day-dd format' + 'W:the date in mm/dd/yy format' + 'D{:format string like strftime' + 'B:start bold' + 'b:stop bold' + 'E:clear to end of line' + 'U:start underline' + 'u:stop underline' + 'S:start standout' + 's:stop standout' + 'f:reset fg color' + 'k:reset bg color' + '{:start literal escape sequence' + '}:stop literal escape sequence' + 'v:value from $psvar array' + '<:truncation from left %len:truncation from right %len>string>' + '[:truncation from who knows where' + ) + fi + _describe -t prompt-format-specifiers 'prompt format specifier' \ + specs -S '' $pre && ret=0 + (( ! $#pre )) && [[ -prefix '(-|)<->' ]] && + _message -e prompt-format-specifiers number +fi + +return ret -- cgit v1.2.3 From b386bbaf29399b7845a546eae16af32af3cc9205 Mon Sep 17 00:00:00 2001 From: Mikael Magnusson Date: Thu, 30 Jul 2015 07:38:50 +0200 Subject: 36119: _strftime: Add completion for zsh/datetime's strftime builtin --- ChangeLog | 3 +++ Completion/Zsh/Command/_strftime | 12 ++++++++++++ 2 files changed, 15 insertions(+) create mode 100644 Completion/Zsh/Command/_strftime (limited to 'Completion/Zsh/Command') diff --git a/ChangeLog b/ChangeLog index 0d1fd009f..03e2b0953 100644 --- a/ChangeLog +++ b/ChangeLog @@ -26,6 +26,9 @@ * 36120: Completion/Unix/Command/_sort: Fix syntax error + * 36119: Completion/Zsh/Command/_strftime: Add completion for + zsh/datetime's strftime builtin + 2015-08-11 Barton E. Schaefer * 36108: NEWS: list of major changes so far since 5.0.8 diff --git a/Completion/Zsh/Command/_strftime b/Completion/Zsh/Command/_strftime new file mode 100644 index 000000000..0be7b078d --- /dev/null +++ b/Completion/Zsh/Command/_strftime @@ -0,0 +1,12 @@ +#compdef strftime + +local ret=1 expl + +_arguments -S -A '-*' -s \ + '-q[run quietly]' \ + '-r[reverse lookup using strptime]' \ + '-s+[assign result to parameter]:param:_parameters' \ + '1:format: _date_formats' \ + '2:epoch time (or date string with -r)' && ret=0 + +return ret -- cgit v1.2.3 From 9a4e1bf93b0bd60b39bb59fb9bc603cfe891b2d1 Mon Sep 17 00:00:00 2001 From: Oliver Kiddle Date: Fri, 14 Aug 2015 11:00:39 +0200 Subject: 36146: avoid mix of -/ and -g with _files as that just overrides user preferences --- ChangeLog | 6 ++++++ Completion/Zsh/Command/_zmodload | 2 +- Completion/Zsh/Type/_command_names | 4 +--- 3 files changed, 8 insertions(+), 4 deletions(-) (limited to 'Completion/Zsh/Command') diff --git a/ChangeLog b/ChangeLog index 6c0151992..f7c734279 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2015-08-14 Oliver Kiddle + + * 36146: Completion/Zsh/Type/_command_names, + Completion/Zsh/Command/_zmodload: avoid mix of -/ and -g with + _files as that just overrides user preferences + 2015-08-13 Daniel Shahaf * unposted: Completion/Unix/Command/_subversion: _subversion: diff --git a/Completion/Zsh/Command/_zmodload b/Completion/Zsh/Command/_zmodload index e144b981e..57fb990e9 100644 --- a/Completion/Zsh/Command/_zmodload +++ b/Completion/Zsh/Command/_zmodload @@ -68,7 +68,7 @@ else _requested loadedmodules expl 'loaded modules' \ compadd -k 'modules[(R)loaded]' && ret=0 _requested files expl 'module file' \ - _files -W module_path -/g '*.(dll|s[ol]|bundle)(:r)' && ret=0 + _files -W module_path -g '*.(dll|s[ol]|bundle)(:r)' && ret=0 _requested aliases expl 'module alias' \ compadd "$suf[@]" -k 'modules[(R)alias*]' && ret=0 done diff --git a/Completion/Zsh/Type/_command_names b/Completion/Zsh/Type/_command_names index d9fc62dfe..940f341cb 100644 --- a/Completion/Zsh/Type/_command_names +++ b/Completion/Zsh/Type/_command_names @@ -17,9 +17,7 @@ defs=( ) [[ -n "$path[(r).]" || $PREFIX = */* ]] && - defs=( "$defs[@]" - 'executables:executable file or directory:_path_files -/g \*\(-\*\)' - ) + defs+=( 'executables:executable file:_files -g \*\(-\*\)' ) if [[ "$1" = -e ]]; then shift -- cgit v1.2.3 From 3f171fd463ed9d10c75fd486eabf33a4c60bb86c Mon Sep 17 00:00:00 2001 From: Mikael Magnusson Date: Sat, 15 Aug 2015 03:02:32 +0200 Subject: 36177: _setopt: complete printexitvalue both ways --- ChangeLog | 5 +++++ Completion/Zsh/Command/_setopt | 5 +++-- 2 files changed, 8 insertions(+), 2 deletions(-) (limited to 'Completion/Zsh/Command') diff --git a/ChangeLog b/ChangeLog index 2966957fb..bd5c0d6a0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2015-08-17 Mikael Magnusson + + * 36177: Completion/Zsh/Command/_setopt: complete printexitvalue + both ways + 2015-08-15 Barton E. Schaefer * 36180: Src/jobs.c: avoid infinite job stop/continue loop on diff --git a/Completion/Zsh/Command/_setopt b/Completion/Zsh/Command/_setopt index fb38d1da6..86c0965f9 100644 --- a/Completion/Zsh/Command/_setopt +++ b/Completion/Zsh/Command/_setopt @@ -2,8 +2,9 @@ local expl ret=1 local -a onopts offopts -onopts=( ${(k)_comp_caller_options[(R)on]} ) -offopts=( ${(k)_comp_caller_options[(R)off]} ) +onopts=( ${(k)_comp_caller_options[(R)on]} printexitvalue ) +offopts=( ${(k)_comp_caller_options[(R)off]} printexitvalue ) +typeset -U onopts offopts case $service in setopt) onopts=(no$onopts) ;; unsetopt) offopts=(no$offopts) ;; -- cgit v1.2.3