Search code examples
vimautocompletehidden-files

Autocomplete hidden files in vim


In vim, when I use something like :e to open files, it doesn't autocomplete files with the hidden prefix .. For example, when trying to edit a .gitignore file, I have to type out the whole name and can't just go :e .giti<Tab>. If I just type :e <Tab>, vim only lists non-hidden files.

I've noticed even FuzzyFinder doesn't actually show hidden files when I use :FufFileWithCurrentBufferDir.

Is there any way I can enable this?


Solution

  • Vim uses wildignore to filter the list of completions when expanding wildcards. Make sure that .gitignore doesn't match a file pattern in that list.

    :help 'wildignore' is copied below

                                                    'wildignore' 'wig'
    'wildignore' 'wig'      string  (default "")
                            global
                            {not in Vi}
                            {not available when compiled without the +wildignore
                            feature}
            A list of file patterns.  A file that matches with one of these
            patterns is ignored when expanding wildcards, completing file or
            directory names, and influences the result of expand(), glob() and
            globpath() unless a flag is passed to disable this.
            The pattern is used like with :autocmd, see autocmd-patterns.
            Also see 'suffixes'.
            Example:
                    :set wildignore=*.o,*.obj
            The use of :set+= and :set-= is preferred when adding or removing
            a pattern from the list.  This avoids problems when a future version
            uses another default.
    

    To find out where it was last set you can use :verbose set wildignore?