When using the programmers text editor vi, I’ll often use a wildcard search to be lazy about the file I want to edit
vi ThisIsAReallLongFi*.txt
When this matches a single file it works great. However, if it matches multiple files vi does something weird.
First, it opens the first file for editing
Second, when I :wq out of the file, I get a message the bottom of the terminal that looks like this
E173: 4 more files to edit
Hit ENTER or type command to continue
When I hit enter, it returns me to edit mode in the file I was just in. The behavior I’d expect here would be that vi would move on to the next file to edit.
So,
-
What’s the logic behind vi’s behavior here
-
Is there a way to move on and edit the next file that’s been matched?
And yes, I know about tab completion, this question is based on curiosity and wanting to understand the shell better.
vi supports having multiple files available for editing.
:ngoes to the next file,:Ngoes to the previous. Use:h arglistfor more information.