Start Vim with splits

If you want to call Vim to edit more than one file, you can add an option to the command line to open all of the buffers in split windows on startup:

  • -O — Open all buffers in vertically split windows, like :vsp
  • -o — Open all buffers in horizontally split windows, like :sp

Command line splits

The same can also be done for tabs:

  • -p — Open all buffers in tabs, like :tabnew

Command line tabs

8 thoughts on “Start Vim with splits

    • I used ffmpeg with -f x11grab to record in lossless mkv, scaled with a video filter, edited, and then converted to GIF with considerable optimising from convert. I haven’t refined the process yet (I’m sure it could be simpler and more easily scripted), but I’m a lot happier with it than I was with my first few attempts.

      It looks something like this:

      $ ffmpeg -f x11grab -r 30 -s 1600x900 -i :0.0+1600,0 -vcodec libx264 -preset ultrafast -crf 0 -threads 0 raw.mkv
      $ ffmpeg -i raw.mkv -r 2 -vf scale=iw/4:-1 -pix_fmt rgb24 processed.gif
      $ convert processed.gif -fuzz 8% -layers Optimize processed.final.gif
      

      What I would really like to do is make GIFs out of ttyrec output.

  1. Hi Tom, will you please set up an RSS feed? I’m too lazy to email you this, which may explain why I use RSS in the first place.

    (Love your blog!)

  2. Just wanted to chime in to say that you can also give a number to set a maximum number of splits or tabs. For example vim -O3 *.[ch] opens all .c and .h files but only creates three vertical splits. =)

    Unfortunately it will create three splits even if there are fewer than three filenames.

  3. Hello, Tom!

    I just wanted to say thanks for your wonderful articles! Your working style and favourite tools are exactly in line of my religion and the way and am trying to set my environment up, and I have learned a lot from you.

    Please, keep up the good work!

  4. Pingback: Vim | kuangmingchen

Leave a Reply

Your email address will not be published. Required fields are marked *

You can use Markdown if you want.

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>