Tip #132: window zooming convenience
tip karma |
Rating 15/10, Viewed by 1560
|
created: |
|
October 11, 2001 13:38 |
|
complexity: |
|
basic |
author: |
|
Salman Halim |
|
as of Vim: |
|
6.0 |
i frequently have multiple windows open in vim -- this reduces the number of lines each window displays -- i almost always have my windows either all the same size or the current one as big as possible.
the following function can be toggled on or off by typing <Leader>max (i can do this quite quickly); just change the mapping at the bottom to something else if you prefer.
this causes the current window to be as big as possible (moving into another window causes that one to become big) and all the others get very small. i actually use this ALL the time. turning it off (by typing the hotkey sequence again) will cause all windows to have the same height.
"toggles whether or not the current window is automatically zoomed
function! ToggleMaxWins ()
if exists ('g:windowMax')
au! maxCurrWin
exe "normal \<c-w>="
unlet g:windowMax
else
augroup maxCurrWin
" au BufEnter * exe "normal \<c-w>_\<c-w>\<bar>"
"
" only max it vertically
au! BufEnter * exe "normal \<c-w>_"
augroup END
do maxCurrWin BufEnter
let g:windowMax=1
endif
endfunction
map <Leader>max :call ToggleMaxWins ()<CR>
<<Scroll alternate window |
Windo and Bufdo >>
Additional Notes
|