Vim paths in that context are more like shell-globs than regular-expressions.
A simple solution in a *nix shell would be
$ vim **/*.py
(This needs extglob
in bash, I think, but should work out of the box in zsh.)
Inside of vim, I'm surprised it would match hidden files in the first place, though :help wildcard
is clear that it matches "anything."
If you can narrow down the patter, that might help (e.g., src/**/*.py
).
Otherwise, you could use a more complex command:
:next `find . -not -path .env -name '*.py'`
:next `git ls-files '*.py'`
etc.
You could create a mapping, if you like:
nnoremap <keys> :next `find . -not -path '*/.*' -type f -name '*.'`<Left><Left>
etc.
These commands can become quite complex, depending on what you're doing, so I won't show all the variations here.
I'll just note as an addendum that I don't generally open all my project files at once; I focus on one or two, and sometimes over a long session (or over a persistent session) lots of files accumulate.
It can be handy to add lots of things to the arglist, however, to allow :argdo
or :vimgrep /.../ ##
. Depending on the case, using the quickfix (combined with :grep
or similar) and :cdo
/:Cfilter
, etc., can be more useful/less invasive/easier to setup.
@filbranden points out wildignore
, which you could probably set to include .*
to avoid matching hidden things.
In all honesty, though, I can't really reproduce the issue. In a directory like this:
.
├── .env
│ ├── a.py
│ ├── b.py
│ └── c.py
├── a.py
├── b.py
└── c.py
1 directory, 6 files
Running vim -u NONE --noplugin --clean
, I have
:next **/*.py
:args
[a.py] b.py c.py