Ad blocker interference detected!
Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers
Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.
created June 26, 2003 · complexity basic · author Hosup Chung · version 6.0
I used to define two different mapping for maximize and restore window. But I wanted a map that can toggle between them. So, I came up with this function. This function assumes you are using win32 version of gvim. If you are using different version, then substitute :simlat ~[rx] by the key combination for your window manager.
Add following lines to your vimrc.
let w:windowmaximized = 0 function! MaxRestoreWindow() if w:windowmaximized == 1 let w:windowmaximized = 0 " restore the window :simalt ~r else let w:windowmaximized = 1 " maximize the window :simalt ~x endif endfunction map <F5> :call MaxRestoreWindow()<CR>
- Maximize_or_set_initial_window_size for other systems
I thought window scope should be used in this case, but it doesn't work when a window has multiple screen. It seems working with global variable.
let g:WindowMaximized = 0 function! MaxRestoreWindow() if g:WindowMaximized == 1 let g:WindowMaximized = 0 " restore the window :simalt ~r else let g:WindowMaximized = 1 " maximize the window :simalt ~x endif endfunction