2

Writing Rails apps means juggling a lot of files. Thank the gods for versatile text editors with multiple buffers, windows and tabs!

I am trying to edit all files in a directory in a new window (in vim, not in gnome). Is there a way to do this with a one-line from within vim? I've been trying every trick I know, but they are to no help.

Martin Josefsson
  • 953
  • 12
  • 24

1 Answers1

4

Use :args to add all your files to the argument list and :argdo to perform an action, here we do :sp filename on each item of the list.

:args *.js | argdo sp

See :h :args and :h :argdo.

romainl
  • 186,200
  • 21
  • 280
  • 313
  • 1
    also see [this](http://stackoverflow.com/questions/12485981/syntax-highlighting-is-not-turned-on-in-vim-when-opening-multiple-files-using-ar) if you have syntax highlighting problems afterwards. – none Sep 23 '12 at 11:03