27

I know I can browse Vim help with :help, but this opens a split. Sometimes, I just like to study documentation. How read documentation in a "full screen" mode?

10 Answers 10

40

Just expand the help window to be the only visible window: Ctrlw-o

When you're done you can switch back to your other buffers.

| improve this answer | |
  • 3
    Similarly, you can switch to the other window with Ctrl-w w and close it with Ctrl-w c, leaving you with just the help. – bsmith89 Feb 4 '15 at 23:47
  • Picking highest voted answer. – Ruslan Osipov Feb 5 '15 at 0:06
19

Alternatively, you could open the help window in a new tab: :tab help foo, and then use :q to close it.

| improve this answer | |
  • 2
    Is there also a way to do this by default? So that :help foo would act as :tab help foo? – Martin Tournoij Feb 6 '15 at 14:44
  • 2
    @Carpetsmoker Yes, you could do something like cnoremap help tab help. – Doorknob Feb 6 '15 at 14:45
14

The other answers have already answered your question, but for the sake of completeness:

If you just want to temporarily get a larger window for your help-viewing, you can use either or both of the Ctrl-w _ and Ctrl-w | mappings to maximise the help window as much as possible vertically or horizontally, respectively, but without closing your existing split windows.

When you subsequently close the help window with Ctrl-w c or :q, your window layout will be returned to exactly how it was before you opened the help window.

This is useful if you have a slightly more complicated window layout which you would like to preserve.

| improve this answer | |
5

You can make the help window full width and height by eliminating all other split windows, using Control-wo while inside the help window. This command makes the current window the only window, removing all other windows.

| improve this answer | |
5

You can move the help screen to its own tab with

ctrl+w T (note the T is upper case).

Then you can switch between the tabs with gt.

| improve this answer | |
2

Another option that gets rid of the pesky extra "new file" tab is vim +"tab help | -tabc". This creates a help tab on vim start (tab help) and removes the new file (-tabc).

| improve this answer | |
1

I often open a new vim instance in another workspace/screen just to pop open a help window so this article was enormously helpful to me. Here Is a bit of VimScript that I just wrote that will open a help page in a new tab, and automatically close a new/empty buffer if necessary. Hopefully it is useful to folks in the future. Thank y'all for your help!

" Help: Open a `help` page in a new tab, or replace the current buffer if it
" is unnamed and empty.
function! Help( query )
  " Is the current buffer empty?
  let l:empty = line( '$' ) ==# 1 && getline( 1 ) ==# ''
  " Store the current tab number so we can close it later if need be.
  let l:tabnr = tabpagenr()
  let l:bufname = bufname( winbufnr( 0 ) )
  try
    " Open the help page in a new tab. (or bail if it's not found)
    execute "tab help " . a:query
    " The help page opened successfully. Close the original tab if it's empty.
    if l:bufname ==# '' && l:empty
      execute "tabclose " . l:tabnr
    endif
  endtry
endfunction

command! -nargs=1 Help call Help( <f-args> )
| improve this answer | |
1

You can also the command:only. It's the same with C-W C-O couple. More on :h only

| improve this answer | |
  • 1
    Welcome to this site Adem, we usually encourage our users to explain why they recommend using a specific command and how it works. It is also usually a best practice to link the relevant help topic like :h :only – statox Jan 15 at 12:28
  • 1
    Got it and changed. Thank you very much. – adem Jan 15 at 12:36
1

I found this on the vim.fandom.com website. It works by making a session before maximizing, then it reloads the previous session view.

Because I have lots of tabs, I had to add exec "tabo" (tabonly) before reloading the session, otherwise you end up with double the number of tabs.

nnoremap <a-m> :call MaximizeToggle()<CR>

function! MaximizeToggle()
  if exists("s:maximize_session")
    exec "tabo"
    exec "source " . s:maximize_session
    call delete(s:maximize_session)
    unlet s:maximize_session
    let &hidden=s:maximize_hidden_save
    unlet s:maximize_hidden_save
  else
    let s:maximize_hidden_save = &hidden
    let s:maximize_session = tempname()
    set hidden
    exec "mksession! " . s:maximize_session
    only
  endif
endfunction

However, when working with a lot of files, I found this 'reload session' method lagged a bit. Maybe someone can comment on how to reduce the lag.

| improve this answer | |
0

I wrote a tiny plugin to do this a few years ago: vim-helptab. It opens help docs in their own tab when you type :h .... To bypass it you can do :he ... or :help ....

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