I just used the help files in vim and now I am stuck in help.

:q Exits the entire program and I am getting tired of having to close and reopen vim every time I use help. I would prefer a command that can close help and return me to the program I am writing.

I have trouble searching google.com because the search string exit help in vim obviously returns articles about exiting vim itself, something I have became very good at.

Does anyone know how to do this?

EDIT: I must have been somehow getting stuck in the split screen thing. That's why I was unable to get out of the help via :q


:q is already the solution.

It closes not the whole vim session, but only the active window (split section within vim). If this is window is the help, only the help will be closed. If your document is active, the document will be closed.

If this is the last non-help window, the help will close as well -- which means vim is closed.

Use Ctrl+W followed by a cursor key to make sure your cursor is in the help window. Then try :q again.

| improve this answer | |

Recent Vims have the :helpclose command (this needs a Vim 7.4.449)

| improve this answer | |

:q is a little bit annoying since this is a readonly buffer. And I believe people rarely need to record a macro in help buffer.

So I'd like to map q to :q:

autocmd FileType help noremap <buffer> q :q<cr>
| improve this answer | |

I use Ctrl+W+C or Ctrl+W+Q, although I agree that like many other more modern read only windows, it would be more natural if we could quit it with just pressing q.

| improve this answer | |

You must have somehow arrived at a sole help window. Usually, :help splits a window, and a :q in that window will just close the help, and return to the other window.

Or, you've typed the :q while in the other window, not the help. Vim doesn't "count" help windows as full windows, and will quit completely when only help windows would be left.

There are quite some window management commands; for example, :close is a variant of :quit that won't exit Vim. Though initially confusing, learn how to use them, as they are very powerful. :help windows has all the information.

| improve this answer | |

:bd will unload the current buffer (exit help) and return you to the last used buffer.

The command will not exit vim.

For example, the commands:

:help :bd

will not exit vim despite the session having only 1 window.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.