Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Textfile-Favoring Completion



On Mar 25,  1:16pm, Chris Johnson wrote:
}
} Now I'm using something slightly simpler that has the same drawback as
} the first solution in hiding certain files when there's a valid match in
} the first group.  (For instance, I want to complete an executable plain
} file 'itself.sh' but there's a directory 'include' that supercedes.)  It
} does cut back on the regular expression maintenance, though.  (I haven't
} entered the extensions for LaTeX yet, so this may change.)
} 
}    # First match files that aren't plain executable files or don't
}    # end in .o.  Failing that, match anything.
}    zstyle ':completion:*:*:(emacs|vi|vim):*' file-patterns \
}           '*~*.o(^*):globbed-files' '*:all-files'

If you're going to go about it that way, look at ignored-patterns:

zstyle ':completion:*:*:(emacs|vi|vim):*' ignored-patterns '*.o'

You may find it easier to maintain the list of excluded patterns there.
The drawback to ignored-patterns is that they're matched only against
the text of the file name, not used as file globs, so you can't, e.g.,
ignore files with the execute bit set.  However, if you combine it
with a variant of your file-patterns style ...

zstyle ':completion:*:*:(emacs|vi|vim):*' file-patterns \
    '*(.^*):globbed-files *(/):directories' '*:all-files'

... you may get something very close to what you want.

Just remember that you may also want to put _ignored into your completer
style somewhere.



Messages sorted by: Reverse Date, Date, Thread, Author