So far I've been using vim */**
which seems to open all files in subdirectories but not those in the current directory, and vim *
which opens all files in the current
directory. But how do I open all files in the current directory and all subdirectories?
How to open all files in the current directory and all subdirectories using vim
vim
Best Answer
With
zsh
:Other shells:
To open only the (non-hidden) regular files (not directories, symlinks, pipes, devices, doors, sockets...) in any level of subdirectories.
Other shells, GNU
find
:To also open hidden files (and traversing hidden directories) and symlinks to regular files.
And:
other shells:
to also traverse symlinks when looking into subdirectories.
If you only want one level of subdirectories:
Note that it's a good habit to prefix your globs with
./
in case some of the file names start with-
or+
.(of course the
find
ones also work inzsh
. Note that they may run several instances ofvim
if the list of files is big, and at least with GNUfind
, will fail to skip hidden files/dirs whose name contains sequences of bytes that don't form valid characters in your locale).