142

Must be something super obvious, but I can't figure out, and Google is not helping out either.

rominf
  • 220
  • 2
  • 6
hakanensari
  • 2,167
  • 3
  • 14
  • 9

4 Answers4

177
: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.

akira
  • 61,009
  • 17
  • 135
  • 165
59

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

g19fanatic
  • 1,369
  • 10
  • 13
  • 5
    fyi: these open the current buffer in a new split, not a new file in a new split. – Emile 81 May 10 '17 at 08:44
  • 5
    For me, `Ctrl+w n` opens a split with a new buffer, but `Ctrl+w v` just splits the current buffer. Strange. – c24w Aug 04 '17 at 08:46
  • 3
    if you're looking to create a vertical split with a new file, check out this question/answer https://vi.stackexchange.com/questions/2811/vertical-equivalent-of-controlw-n – g19fanatic Aug 04 '17 at 11:42
  • note that `:split ` would open/edit a file in splitwindow. – Louis Go Nov 25 '20 at 01:31
4
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

n.st
  • 1,908
  • 1
  • 17
  • 30
JayS
  • 151
  • 2
0

I used the Vim menu under File - Split Open. You will have to give a name for your new blank file though.

Rolnik
  • 1,677
  • 2
  • 16
  • 28