I'm trying to open and edit a series of files with vim. My expected behaviour, is that vim opens one file, I edit it, type :wq
, vim closes and saves that file, and then immediately opens the next file for me to start editing.
I did some googling, and several results profered the solution of vim *
or vim pattern*
, with variations on standard unix shell file globbing syntax.
However, when I try this on my system, I get unexpected behaviour. After I edit and :wq
, vim seems to open that same, first file again (with the saved changes), and then another :wq
dumps me back on the command line. No other files were opened for editing
Edit I tried two methods to escape the asterisk, in case something wasn't reading the glob properly
$ vim webform.webform.\*
$ vim "webform.webform.*"
However both of these syntaxes gave me a vim screen where it was editing a new file with the literal name webform.webform.*
Here's what I originally attempted, with the unexpected behavior:
$ vim webform.webform.*
Vim opens the first file:
... ...
100 draft_pending_multiple_message: ''
101 confirmation_type: page
102 confirmation_title: ''
103 confirmation_message: ''
"webform.webform.my_webform.yml" 184L, 8621C
I edit the file, save, and close it:
:wq
Vim notes that the changes were written, indicates how many files are left to edit, wants me to hit enter for some reason:
"webform.webform.my_webform.yml" 184L, 8621C written
E173: 130 more files to edit
Press ENTER or type command to continue
Then it opens again the same first file that it just opened.
100 draft_pending_multiple_message: ''
101 confirmation_type: page
102 confirmation_title: ''
103 confirmation_message: ''
1,1 Top
I save and close:
:wq
Now I'm back at the bash prompt, no additional files opened in vim.
$
I want to open a file, edit it, save it, close it, and edit the next file. What am I doing wrong?
$ bash --version
GNU bash, version 4.4.12(1)-release (x86_64-pc-linux-gnu)
$ vim --version
VIM - Vi IMproved 8.0 (2016 Sep 12, compiled Jun 21 2019 04:10:35)
...
$ cat /etc/os-release
PRETTY_NAME="Debian GNU/Linux 9 (stretch)"
...