Is better way to zoom windows in Vim than ZoomWin?
I try to use vim without any plugins as I don't want to rely on them when I work on another system. Coming upon this same issue now, I can propose some 'better ways' (alternative ways) as requested by the OP:
-
c-w-|
to have window take over (if using vsplits).c-w-=
to restore.c-w-_
for horizontal splits - close the other window(s), thereby making current one fullscreen. Split and re-open from buffer to restore
- use
tmux
if available and run multiple instances of vim,c-b-z
to switch between fullscreen for the current pane
I have listed these in order of my perceived practicality. Experience will of course be better with a dedicated plugin, but that is not always an option.
A simple alternative (which may be enough depending on what you need):
" Zoom / Restore window.
function! s:ZoomToggle() abort
if exists('t:zoomed') && t:zoomed
execute t:zoom_winrestcmd
let t:zoomed = 0
else
let t:zoom_winrestcmd = winrestcmd()
resize
vertical resize
let t:zoomed = 1
endif
endfunction
command! ZoomToggle call s:ZoomToggle()
nnoremap <silent> <C-A> :ZoomToggle<CR>
The ZoomWin version 24 introduced saving of window-local variables. When I've tried it out, I found the performance unacceptable, probably because of the various other plugins that I have installed and which install various event handlers.
I've reported my issues to the plugin author and he replied that
v25a of ZoomWin has the g:zoomwin_localoptlist and noautocmd stuff.
So, either try reverting to version 23 (which I did), or try out the latest version with the mentioned setting turned off from http://drchip.org/astronaut/vim/index.html#ZOOMWIN