Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I open a help file in Vim on a new buffer in an existing window?

Tags:

I often take a look at help files in Vim, but sometimes I want to read one in full screen. Since the :help command opens it in a new window, and closing the old window, if it was the only one besides of the help file, for some reason closes Vim, the only way I found of doing this was opening the help file, and then reopening it in a new tab.

I wondered, is there any way to make the :help command (or another command) to open a help file in the same window, but a new buffer?

like image 972
Martín Fixman Avatar asked Jun 29 '10 02:06

Martín Fixman


2 Answers

You might be looking for :only or CTRL-W o (the same command). This makes the current window the only one on the screen. All other windows are closed.

You can also vertically split the help window with:

:vert help {subject} 

BTW, :help actually does open in a new buffer, it's just "unlisted". To list all buffers, including the unlisted ones:

:buffers! 
like image 107
Curt Nelson Avatar answered Sep 18 '22 19:09

Curt Nelson


If I understand the question correctly, all you need to do is to chain the help command call with the only command:

 :help <subject> | only 
like image 29
Shamaoke Avatar answered Sep 19 '22 19:09

Shamaoke