Sagar Jain
Sagar Jain

Reputation: 7941

How to open a file from buffer in a split window?

I've two files say, file1.txt and file2.txt added to buffer in vim. I've currently opened file1.txt and I know that the command :b2 opens file2.txt from the buffer.

But, I would like to open file2.txt in the split window, keeping file1.txt. Is there a way to do it, without using the commands such as :vs file2.txt ? I am looking for a command which operates on buffer.

Upvotes: 0

Views: 434

Answers (1)

romainl
romainl

Reputation: 196826

:sb2

opens buffer #2 in an horizontal window.

:vert sb2

opens buffer #2 in a vertical window.

:tab sb2

opens buffer #2 in a new tab page.

:sb is 12 lines below :help :b so… try a little harder next time.

Upvotes: 1

Related Questions