sudoremo
sudoremo

Reputation: 2402

How to close all tabs and windows but keep vim open

The title says it: How can I quickly close everything but keep vim open (show the starting view again)?

Upvotes: 3

Views: 125

Answers (1)

Jonathan.Brink
Jonathan.Brink

Reputation: 25433

You can perform window and tab operations using the windo and tabdo commmands (though I didn't use these in the provided mapping below)

To show the starting view again, run :intro:

Here is a little mapping to accomplish your original question that seemed to work best for me:

" this will fail if there are unsaved changes
function! StartOver()
  new     " open a new, empty split
  only    " close other windows
  tabonly " close other tabs
  intro   " show opening screen
endfunction
nnoremap <F4> :call StartOver()<CR>

Upvotes: 5

Related Questions