Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I managed to configure zsh such that it does not suggest LaTeX temporary files when I use autocompletion for emacs by adding this line to my ~/.zshrc:

zstyle ':completion:*:*:emacs:*:*files' ignored-patterns '*?.aux' '*?.bbl' \
'*?.blg' '*?.out' '*?.log' '*?.toc' '*?.snm' '*?.nav' '*?.pdf' '*?.bak' '*\~'

Now zsh ignores all LaTeX temporary files when I request completions for emacs.

How can I achieve the same for svn add?

So far I have only found out that the completion for svn is rather complicated and was even broken for some time. Just exchanging emacs in the above example does not work because I need to affect the completion for the add parameter of svn. Does someone have an idea?

share|improve this question
I'm interested in the answer too. This page could help: zsh.sourceforge.net/Doc/Release/Completion-System.html. I'm currently reading it to see what could be hacked around zstyle. – lgeorget May 14 '13 at 21:23
up vote 4 down vote accepted

This line will give you what you want:

zstyle ':completion:*:*:svn-add:*:*files' ignored-patterns '*?.aux' '*?.bbl' \
'*?.blg' '*?.out' '*?.log' '*?.toc' '*?.snm' '*?.nav' '*?.pdf' '*?.bak' '*\~'

From http://zsh.sourceforge.net/Doc/Release/Completion-System.html:

The command or a special -context-, just at it appears following the #compdef tag or the compdef function. Completion functions for commands that have sub-commands usually modify this field to contain the name of the command followed by a minus sign and the sub-command. For example, the completion function for the cvs command sets this field to cvs-add when completing arguments to the add subcommand.

share|improve this answer
Wow, that was easy. Thanks a lot. I now also added cvs by exchanging "svn-add" with "(svn|cvs)-add". – Robert May 15 '13 at 5:02
You're welcome ! And thanks to you for the question, I learnt something too. Apparently, you can also customize according to the options in the command-line replacing the * after svn-add with something like option-depth-1. I'm currently trying this feature. – lgeorget May 15 '13 at 12:21

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.