In a given working directory, if I do
:tabe **/test*.py
vim
complains with E77: Too many file names
. What if I want it to open every matching file in a separate tab? There must be a way to do it, but I can't find it.
You can switch between tabs with :tabn and :tabp , With :tabe <filepath> you can add a new tab; and with a regular :q or :wq you close a tab. If you map :tabn and :tabp to your F7 / F8 keys you can easily switch between files.
1 Invoking vi on Multiple Files one. When you first invoke vi, you can name more than one file to edit, and then use ex commands to travel between the files. invokes file1 first. After you have finished editing the first file, the ex command :w writes (saves) file1 and :n calls in the next file (file2).
You could use the args
list and argdo
like so:
:args **/test*.py :argdo tabe %
However, the syntax event is turned off by argdo
(to speed up the normal use case), so the files will be loaded without syntax at first. You could follow it up with a :syntax on
to force the syntax event on all loaded buffers. Compressed into one line (need to wrap argdo
in execute
so it doesn't absorb the following |
):
:args **/test*.py | execute 'argdo tabe %' | syntax on
Alternately, you can open vim from the command line via:
vim -p **/test*.py
But that will max out at 10 tabs.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With