diff options
author | Peter Stephenson <pws@users.sourceforge.net> | 2007-01-16 10:54:07 +0000 |
---|---|---|
committer | Peter Stephenson <pws@users.sourceforge.net> | 2007-01-16 10:54:07 +0000 |
commit | 110ae85114abc12211e2fcae7dafc6400e57cdb1 (patch) | |
tree | 5d825bee5db476d72e86e889ed37fd5f23b71702 /Completion/Unix/Command | |
parent | 7f6ea229a81ee728befe64d8a97c397fdc3dffb8 (diff) | |
download | zsh-110ae85114abc12211e2fcae7dafc6400e57cdb1.tar.gz zsh-110ae85114abc12211e2fcae7dafc6400e57cdb1.tar.xz zsh-110ae85114abc12211e2fcae7dafc6400e57cdb1.zip |
users/11113: improve _todo.sh
Diffstat (limited to 'Completion/Unix/Command')
-rw-r--r-- | Completion/Unix/Command/_todo.sh | 30 |
1 files changed, 12 insertions, 18 deletions
diff --git a/Completion/Unix/Command/_todo.sh b/Completion/Unix/Command/_todo.sh index 455bb3d85..3bae98b1a 100644 --- a/Completion/Unix/Command/_todo.sh +++ b/Completion/Unix/Command/_todo.sh @@ -13,7 +13,7 @@ setopt localoptions braceccl local expl curcontext="$curcontext" state line pri nextstate -local -a cmdlist itemlist +local -a cmdlist itemlist match mbegin mend integer NORMARG _arguments -s -n : \ @@ -26,7 +26,8 @@ _arguments -s -n : \ '1:command:->commands' \ '*:arguments:->arguments' && return 0 -local txtmsg="text, can include p:<project> and @<where>" +local projmsg="context or project" +local txtmsg="text with contexts or projects" case $state in (commands) @@ -60,11 +61,7 @@ case $state in nextstate=pri ;; (append|prepend) - if [[ -prefix p: || -prefix @ ]]; then - nextstate=proj - else - _message $txtmsg - fi + nextstate=proj ;; (replace) compadd -Q -- "${(qq)$(todo.sh -p list "^0*${words[CURRENT-1]} ")##<-> }" @@ -73,15 +70,7 @@ case $state in fi ;; - (add) - if [[ -prefix p: || -prefix @ ]]; then - nextstate=proj - else - _message $txtmsg - fi - ;; - - (list|listall) + (add|list|listall) nextstate=proj ;; @@ -115,8 +104,13 @@ case $nextstate in (proj) # This completes stuff beginning with p: (projects) or @ (contexts); # these are todo.sh conventions. - _wanted search expl 'context or project' \ + if [[ ! -prefix p: && ! -prefix @ ]]; then + projmsg=$txtmsg + fi + # In case there are quotes, ignore anything up to whitespace before + # the p: or @ (which may not even be there yet). + compset -P '*[[:space:]]' + _wanted search expl $projmsg \ compadd ${${=${${(M)${(f)"$(todo.sh -p list)"}##<-> *}##<-> }}:#^(p:*|@*)} ;; esac - |