zsh-workers
 help / color / mirror / code / Atom feed
* ignore-line style
@ 2001-10-09 15:52 Oliver Kiddle
  2001-10-15 14:03 ` Sven Wischnowsky
  0 siblings, 1 reply; 7+ messages in thread
From: Oliver Kiddle @ 2001-10-09 15:52 UTC (permalink / raw)
  To: zsh-workers

I use this style:

zstyle ':completion:*:*:(cat|diff|less|rm|vi):*' ignore-line true

So, filenames I've already mentioned are not offered for completion
with these commands. This is useful but there is a problem:

With diff, it is quite common to compare a file to another file with
the same name in a different directory but this style blocks completion
of the second file. e.g: diff file ../fi<tab>
It needs to include the `../' in the comparison against other words on
the line.

The patch below adds a `full-word' value for ignore-line to show a
possible fix but I think we need more than this patch. This doesn't
work if the current line includes words which are patterns for a start.

This change is perhaps needed in conjunction with the `other' value
too. And it would be useful to be able to ignore the first word (the
command) as well as the current one.

Next, there could be an option to use "${(q)words[@]}" to quote
the words so they aren't used as patterns - useful if the command is
being used with noglob or with non-file parameters. Otherwise, working
like a real file glob so *.o doesn't match .o would be nice. And maybe
a way to define a further pattern which words in _comp_ignore need to
match so that you can exclude any non-file arguments such as options.

I also wonder whether we shouldn't be passing the previous words as a
-F argument to compadd from _diff & co. in the first place.

Any thoughts or ideas?

Oliver

--- Completion/Base/Core/_description     Tue May  8 10:12:50 2001
+++ _description        Tue Oct  9 15:38:53 2001
@@ -38,6 +38,7 @@
   zstyle -s ":completion:${curcontext}:$1" ignore-line hidden &&
     case "$hidden" in
     true|yes|on|1) _comp_ignore=( "$_comp_ignore[@]" "$words[@]" );;
+    full-word) _comp_ignore=( "$_comp_ignore[@]" "${(M)words[@]:#$PREFIX*$SUFFIX}" );;
     current)       _comp_ignore=( "$_comp_ignore[@]" "$words[CURRENT]" );;
     current-shown) [[ "$compstate[old_list]" = *shown* ]] &&
                        _comp_ignore=( "$_comp_ignore[@]" "$words[CURRENT]" );;

_____________________________________________________________________
This message has been checked for all known viruses by the 
MessageLabs Virus Scanning Service. For further information visit
http://www.messagelabs.com/stats.asp


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2001-10-19 16:57 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-10-09 15:52 ignore-line style Oliver Kiddle
2001-10-15 14:03 ` Sven Wischnowsky
2001-10-15 15:12   ` Nadav Har'El
2001-10-17 13:27   ` Sven Wischnowsky
2001-10-18 16:32     ` Oliver Kiddle
2001-10-19  9:29       ` Sven Wischnowsky
2001-10-19 16:50         ` Oliver Kiddle

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).