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/_fc') 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/_fc') 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