Search code examples
macosbashvimtab-completion

How can I make my vim behave like my cat?


Current I have the following going on, vim seems to inexplicably enter into the first folder it finds and continue tab completion from there. When hinting a more complete name, it just gives me a bell.

~ $ cat .bash <TAB>
.bash/
.bash_history
.bash_profile
.bashrc

~ $ vim .bash <TAB>
~ $ vim .bash/ <TAB>
~ $ vim .bash/git-aware-prompt/

~ $ vim .bash_ <TAB>
<BELL>

Using vim 7.4.488 on OSX

How can I make my vim behave like my cat?


Solution

  • Sometimes it can happen that this is not in your .bashrc

    # enable programmable completion features (you don't need to enable
    # this, if it's already enabled in /etc/bash.bashrc and /etc/profile
    # sources /etc/bash.bashrc).
    if [ -f /etc/bash_completion ] && ! shopt -oq posix; then
        . /etc/bash_completion
    fi
    

    Another possible issue can be resolved by running

    complete -r vim
    

    which can restore vim rules of completion to its default. I hope these suggestions can help you to point you in the right direction.