Stop bash tab completion from thinking I want to cd into .svn directories

I have a folder structure that's in subversion.

There are a whole pile of top level directories that have only 1 sub folder. (eg src/com/example). Normally when I want to cd into the example folder I can go cd src/<tab><tab> since bash will fill in the folder names, since there is only one per folder it goes all the way.

However since that directory structure is now in svn, there's a .svn directory in each one, and this means I can't cd as quickly.

If I try cd src/<tab> it suggests .svn and com, as opposed to automatically filling in com.

Is there some way to tell bash never to suggest cd'ing into a .svn folder, so that if I tab complete it won't include .svn?


Solution 1:

I can give you two options. Either of which can be placed in your ~/.bash_profile.

  • Bash uses a variable $FIGNORE which defines any suffixes that auto-completion will ignore. There seems to be a catch though, in that it prefixes any value with *.. So a setting of:

    export FIGNORE=.svn
    

    Will only ignore directories that have something before the period. And:

    export FIGNORE=svn
    

    Will ignore .svn directories and anything else that ends in .svn.

    Caveat emptor.

  • You can prevent all hidden files and directories from being included in auto-completion:

    bind 'set match-hidden-files off'
    

    But you might not find this suitable.