mlsamuelson.com

Split windows in Vim

vim -O filename1 filename2 filename3

from command line, open files in vertical windows.

vim -o filename1 filename2 filename3

from command line, open files in horizontal windows.

:split filename.php

inside Vim, open filename.php in a new buffer and split window horizontally. use :vsplit filename.php to split vertically. additionally, you can use the short forms :sp and :vsp.

CTRL+w v

split current window vertically into two windows. do again and you'll get a third window, etc. replace v with s and you'll split horizontally instead.

CTRL+w w

switch windows

CTRL+w j

switch to window below active window. (can use other directional keys - h k and l)

CTRL+w +

increase height of active window.

CTRL+w -

increase height of active window.

CTRL+w <

decrease width of active window.

CTRL+w >

decrease width of active window.

CTRL+w q

quit window. :bd (buffer delete) works too.

:bd

delete buffer (closing current window)

These commands work well in conjunction with Edit Mulitiple Files in Vim.

No comments

Add your comment

The content of this field is kept private and will not be shown publicly.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.
  • You may post code using <code>...</code> (generic) or <?php ... ?> (highlighted PHP) tags.

More information about formatting options

Find Me Around

User login