I've gotten really tired of manually switching and resizing windows in vim. You can create more than one window in vim with :split or :vpslit, but navigating between them is often an annoying combination of "control w, direction key towards the window you want go to". Of course, if you hit the wrong direction key, you don't move anywhere and you silently curse because you were hitting "h" instead of "j". But then the windows often take up large chunks of real estate, so they're tough to read, but you don't want to keep only one window open and switching buffers all the time, so basically, window navigation can be a pain (even with BufExplorer and other plugins).
What some vim users aren't aware of is that you can type "control W, control W" and it will simply cycle you to the next window. You have to do this a few times if you have more than one window open, but since you don't have to move your fingers and remember navigation keys, it's quick and easy. Thus, I wrote this mapping (this does something similar to what other developers on our team do, but fits my work style a touch better):
noremapw :res
In other words, it automatically switches to the next window and resizes it. You can still see the other windows, but they're out of the way.
The:res
command also has a keystroke, Ctrl+W _
.
There's also:set winheight
and:set winwidth
Each of these set the default height/width of the current window, so whatever you switch to takes up the appropriate amount of room.
map <C-J> <C-W>j<C-W>_
map <C-K> <C-W>k<C-W>_