3

As mentioned, when using <TAB> completion, hidden files do not show up. E.g. :e <TAB> only shows non-hidden files.

:verbose set wildignore?
  wildignore=

A similar question is here, while an unanswered one is here. Obviously both didn't help me.

How to debug this? How do I display hidden files/folders when using tab?

2
  • 1
    If I hit .<Tab>, I get hidden files (.<C-d> too)
    – D. Ben Knoble
    Oct 5 '20 at 22:37
  • @D.BenKnoble this also lists hidden files for me. However, I want hidden files to show up next to non hidden ones when using <TAB> alone.
    – Stefan
    Oct 6 '20 at 5:02
2

Hidden files do not automatically show up in wildcard expansions unless there's a leading dot, but this behavior can be switched on in the source code.

Let's dive in. src/vim.h defines a number of flags that determine how wildcard expansions are to be performed. One of them is EW_DODOT, which if set will cause wildcard expansions to pick up dot files automatically.

Looking at the latest version of the code with git grep EW_DODOT, nowhere in the code does there occur any setting of the EW_DODOT flag. The flags are initially set here in ExpandFromContext() in src/cmdexpand.c and if you set it by adding flags |= EW_DODOT and recompile vim it will expand dot files by default. You can confirm it by either :e <tab> or :echo expand('*') in a directory that contains hidden files.

If it were to become a configurable option, it would probably appear in this list. The options listed there take effect in ExpandFromContext() by having respective flags set based on them.

Searching back through the history for changes involving EW_DODOT by running git log -GEW_DODOT, it looks like the EW_DODOT internal flag was introduced in commit b0967d58 (which was vim release 7.4.1116) and was at that time used in a call to gen_expand_wildcards(), but only when invoking delete_recursive() to recursively delete a directory tree. All uses of this flag were completely discarded with a major code change in commit 701ff0a3 with a new implementation of recursive file removal. We can confirm that even at that point the EW_DODOT flag was not set dynamically like some of the others in ExpandFromContext(), so this internal feature simply got buried.

3
  • Thanks. To briefly sum up, currently this is not possible without building vim from source. Do you have any idea about nvim?
    – Stefan
    Aug 3 '21 at 8:53
  • Let's check the source code.
    – webninja
    Aug 3 '21 at 10:33
  • 2
    For others coming here and wondering: After briefly looking into the source code of nvim, I think something similar is true. It appears that the flags and and functions are named the same but filenames are different. In any case the flag EW_DODOT is also not set in ExpandFromContext().
    – Stefan
    Aug 4 '21 at 5:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.