Code Yarns ‍👨‍💻
Tech BlogPersonal Blog

How to enable case insensitive filename completion in Vim

📅 2014-Jan-24 ⬩ ✍️ Ashwin Nanjappa ⬩ 📚 Archive

[caption id="attachment_4181" align="aligncenter" width="330"][Vim with case insensitive filename autocompletion](http://codeyarns.files.wordpress.com/2014/01/20140124-vim-wildignorecase.gif) Vim with case insensitive filename autocompletion[/caption]

Opening files and directories from inside Vim can be a bit irritating. This is because it expects you to type the correct case sensitive prefix of the filename or directory before you can autocomplete it by pressing Tab. There are two problems here: Vim wants you to type the prefix and the prefix needs to match the filename with correct case. The second problem here can now be fixed in 7.3 and later versions of Vim.

The wildignorecase option can be set to enable Vim to perform case insensitive autocompletion of filename or directories.

To set it in your .vimrc use:

set wildignorecase

If you use your .vimrc across older and newer versions of Vim, then you might want to check for this option before you set it:

if exists("&wildignorecase")
    set wildignorecase
endif

Tried with: Vim 7.3 and Ubuntu 12.04