Skip to content

Instantly share code, notes, and snippets.

@valer-cara
Created August 11, 2014 18:48
Show Gist options
  • Save valer-cara/7b32d5ca76aacef566db to your computer and use it in GitHub Desktop.
Save valer-cara/7b32d5ca76aacef566db to your computer and use it in GitHub Desktop.
fu! ZoomWindow()
let [l:i, l:max, l:min] = [1, 0, 999999]
while winwidth(l:i) > 0
if winwidth(l:i) > l:max
let l:max = winwidth(l:i)
endif
if winwidth(l:i) < l:min
let l:min = winwidth(l:i)
endif
let l:i = l:i + 1
endwhile
if abs(l:max - l:min) > 5
execute "normal ^W="
else
execute "normal ^W\|^W_"
endif
endfunction
map <Leader>m :call ZoomWindow()<CR>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment