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.


1 Answer 1


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.

  • Wow, that was easy. Thanks a lot. I now also added cvs by exchanging "svn-add" with "(svn|cvs)-add".
    – Robert
    May 15, 2013 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, 2013 at 12:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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