eighties.vim (GitHub: justincampbell / vim-eighties, License: MIT) by Justin Campbell will automatically resize windows when switching between them. It calculates the size based on the longest line and takes into account signs -- the default width is 80 characters. It ignores file browsers, so it won't resize NERDTree.
The configuration options are as follows:
let g:eighties_enabled = 1 let g:eighties_minimum_width = 80 let g:eighties_extra_width = 0 " Increase this if you want some extra room let g:eighties_compute = 1 " Disable this if you just want the minimum + extra
It has shortcuts for "zooming" into the main window, and various other window manipulation functions. Full documentation is available in the project's readme.