Frank Cheng
Frank Cheng

Reputation: 6206

Is it possible to restore windows status after maximum window?

I always have this problem. When a windows seems too small to view code, i will type :only the maximum this window and hide other windows. But when the editing is finished i quit want to restore the previous status of windows. Exactly the same before i maximum one window. It there any plugin to do this job? Or it's build-in in vim?

EDIT: I found a plugin called ZoomWin can actually do this job. But 0 can't been map to :ZoomWin in my vim. Still don't know why. The help file says i can use 0 to call Zoomvim just after i installing this plugin.

Upvotes: 4

Views: 255

Answers (1)

Randy Morris
Randy Morris

Reputation: 40947

You could probably write a script using mkview and loadview if you wanted to keep this all in one tab, however, this is the exact thing that vim's tabs were made for. I suggest using the following mapping to map \0 to open the current buffer in a new tab. To close the tab just do :q as you would normally do and you'll go back to your previous tab which contains the window layout you want.

:nnoremap <leader>0 :tabedit %<cr>

Note that this mapping uses <leader> so if you've changed your mapleader then the sequence will not be \0.

Upvotes: 2

Related Questions