How do I open a blank new file in a split in Vim?

:help new
:help vnew

should bring you on course.

you will have a new buffer then, obviously. that buffer becomes a file only if you :w it to the disk.


another way is to do a <CTRL + W> n in normal mode. This will create a new split.

EDIT:

You can also do <CTRL + W> v in normal mode to create a vertical split (the previous one will do a horizontal split.

And just to be complete, you move to the different splits by doing <CTRL + W> <direction> with the direction being any h, j, k, or l

To close a buffer, do <CTRL + W> q


vim myfile.txt  # open one file in one window
:buffers        " shows one buffer with "myfile.txt" in it
:sp             " create split window; we now have one buffer with two windows.
:e newfile.txt  " create new buffer with new filename in first window
:buffers        " shows two buffers (myfile.txt & newfile.txt), each in own window

This is a good link: http://vim.wikia.com/wiki/Easier_buffer_switching

Tags:

Vim