Search code examples
vimwindowbuffer

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


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?


Solution

  • 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!