Tip #494: maximize or restore window
tip karma |
Rating 8/2, Viewed by 1557
|
Read and edit this tip on the
Vim tip wiki.
The wiki may have a more recent version of this tip.
created: |
|
June 26, 2003 8:01 |
|
complexity: |
|
basic |
author: |
|
Hosup Chung |
|
as of Vim: |
|
6.0 |
I used to define 2 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 on your [._]g*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>
<< Open the directory for the current file in Windows |
Backspace key using puTTY to RH9 box >>
Additional Notes
Anonymous,
June 26, 2003 12:12
|
hmm.. 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
|
gmannATfemtoDOTTmeddOTTuncDOTTedu,
June 27, 2003 18:12
|
I don't know how to spell this correctly but: NI TSONGMING
|
|