Most of us are Vim users and have tweaked our favorite editor for speed and convenience. See thoughtbot’s dotfiles.

One of my favorite tools is the window split. Here is a quick splits overview and configurations to use them more effectively.

Create a vertical split using :vsp and horizontal with :sp .

By default, they duplicate the current buffer. This command also takes a filename:

: vsp ~ / . vimrc

You can specify the new split height by prefixing with a number:

: 10 sp ~ / . zshrc

Close the split like you would close vim:

: q

We can use different key mappings for easy navigation between splits to save a keystroke. So instead of ctrl-w then j , it’s just ctrl-j :

nnoremap < C - J > < C - W >< C - J > nnoremap < C - K > < C - W >< C - K > nnoremap < C - L > < C - W >< C - L > nnoremap < C - H > < C - W >< C - H >

Open new split panes to right and bottom, which feels more natural than Vim’s default:

set splitbelow set splitright

Vim’s defaults are useful for changing split shapes:

"Max out the height of the current split ctrl + w _ "Max out the width of the current split ctrl + w | "Normalize all split sizes, which is very handy when resizing terminal ctrl + w =

"Swap top/bottom or left/right split Ctrl + W R "Break out current window into a new tabview Ctrl + W T "Close every window in the current tabview but the current one Ctrl + W o

As with everything in Vim, for more information, check the well-written helpfiles. In Vim, :help splits .

If you found this useful, you might also enjoy: