9

I know about running

vim -p file1 file2 file3

But is there away to do something similar from within vim? What I've thought about wanting to do is

:tabe file1 file2 file3

or (IMO worse, but still an improvement):

:edit file1 file2 file3

...but neither of those are possible, by default at least.

miyalys
  • 433
  • 9
  • 20
  • This is similar to the following post: Using Vim's tabs like buffers - http://stackoverflow.com/questions/102384/using-vims-tabs-like-buffers – Peter Rincker Feb 07 '13 at 17:48

2 Answers2

9

try this:

:args file1 file2 file3 |tab sall

this will only put newly opened file (file1, file2, file3) in tabs, not all buffers.

if you want to open all buffers in tabs, replace sall to sball

btw, is tab convenient to work with? personally I like working with buffer more...

Kent
  • 189,393
  • 32
  • 233
  • 301
  • I agree. I prefer working with buffers as well. For more information why to use buffers for tabs take a look at this vimcasts by Drew Neil: http://vimcasts.org/episodes/how-to-use-tabs/ – Peter Rincker Feb 07 '13 at 17:47
  • Thanks! That's similar to the approach I write about above, except slightly simpler with the piping. Do you know if it's possible to do a recursive args/arga, so you can do: :cd directory :arga * | tab sball ? – miyalys Feb 08 '13 at 09:12
5

Upon browsing the web more extensively, researching in regards to this question, the best solution I've found so far is:

:arga file1 file2 file3 (...)

Which will create buffers for all the input files. Then follow that by:

:tab sball

Which will open all the buffers into separate tabs. But maybe there's an even better/shorter way? If not maybe I'm helping someone else out there, having the same problem/question.

miyalys
  • 433
  • 9
  • 20