Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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

When I type "svn add path/to/somefile..." and tab to autocomplete, the system should only complete files/directories that are not currently under SVN control. Likewise, when I commit, remove or resolve files, the tab completion should only complete files that are relevant to what I'm doing (i.e., modified, currently in SVN or conflicted). This is especially important in SVN where every single file name you type could potentially benefit from smart autocompletion, but it of applies to other programs.

I know bash has a bash_completion file that can be used to programatically alter this behaviour but I've not found a decent example of SVN completion which actually completes file names rather than SVN command names.

My question is: Does anyone have such a setup? Does anyone use a different shell or tool that does something similar? Has anyone given this any thought?

share|improve this question
Note: I found a script here but it does not work: – Jimmy Apr 23 '10 at 13:08
up vote 3 down vote accepted

Take a look at the completion script found here. It may approach doing what you want.

An excerpt looks promising:

    # 'files' is set according to the current subcommand
    case $cmd in
        st*) # status completion must include all files
        ci|commit|revert|di*) # anything edited
        files=$($status $cs| _svn_grcut '@([MADR!]*| M*|_M*)')
        add) # unknown files
        files=$($status $cs| _svn_grcut '\?*')
share|improve this answer
This seems to do it! Note that you must specifically enable file autocompletion in this script - search for the word 'svnstatus' for the relevant setting. I just cant believe people are insane enough not to demand a feature like this from day one. How on earth do people use svn without it? – Jimmy Apr 23 '10 at 13:31

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.