Slash Boxes
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

Ovid (2709)

  (email not shown publicly)
AOL IM: ovidperl (Add Buddy, Send Message)

Stuff with the Perl Foundation. A couple of patches in the Perl core. A few CPAN modules. That about sums it up.

Journal of Ovid (2709)

Tuesday October 27, 2009
05:52 AM

Switching and resizing windows in vim

[ #39807 ]

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):

noremap <Leader>w <C-W><C-W>:res<cr>

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 Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
More | Login | Reply
Loading... please wait.