Editing Multiple files in vi with Wildcards
ANSWER TO CURRENT QUESTION
You may write: vim -p myfile*
and vim will open all the matches for myfile*
in the current directory into multiple tabs. Then, you can edit all files one by one. Navigate using gt
for going to the next tab and gT
for going to the previous tab. For saving and quiting all the files in a single go, just write :wqa
inside vim.
ANSWER TO A SIMILAR PROBLEM
I was facing a similar problem. I had a file named "myfile*" inside multiple subdirectories of my current directory. I wanted to edit a small change in all of them without getting to open them one by one. So, in the command line, I wrote this :
$find . -type f -name "myfile*" -exec vim -f {} \;
This way, find runs vim for each file. As soon as I quit an instance of vim, find automatically runs another with the next file until all of them have been done. Although, I agree that it would have been better if all the files could have been opened as tabs.