When working with multiple files, it would be very handy if we can see more than one file in the screen at once. Is there any way in Vim to split the window (horizontally or vertically) so each split can show a different file?

5 Answers 5


Yes, vim has the ability to split both horizontally using :split and vertically using :vsplit which both work just like :edit for opening a file, except they open it in a horizontal / vertical split respectively.

Additionally, I would recommend to also read :h window-move-cursor for moving around different splits with ease.


Yes, there are the :split (split into two windows, top half and bottom half) and :vsplit (left and right) commands. You can then use Ctrl-W direction to switch windows (where direction is one of the normal hjkl cursor movement keys, or the arrow keys).

You can then :edit (etc.) a different file in each window.

Full documentation is at :help windows.txt.


You can either split vim windows by opening multiple files using -o, -O, -o2 parameters.

Or if you're already editing multiple files in one window, you can use :ba to split horizontally or :vert ba to split vertically.

:[N]ba[ll] [N] :[N]sba[ll] [N] Rearrange the screen to open one window for each buffer in the buffer list.

:vert[ical] {cmd} Execute {cmd}. If it contains a command that splits a window, it will be split vertically.

To quit, use: :qa.

See also:


You can use :split or :vsplit for horizontal and vertical splits respectively. Provide the path to the file you want to open to open a specific file. Or just type the command to open a copy if the current file.

You can then move between splits using C-w + hjkl.

  • 20
    A shortcut for a horizontal split is :sp, with the vertical shortcut being :vsp. Commented Feb 3, 2015 at 17:59

You can use below command from terminal:

gvim -O file1.txt file2.txt
  • 1
    Welcome and thank you for writing an answer. The -O parameter is already covered by kenorb's answer. Please post only unique answers and vote for existing answers. You may want to take the tour to learn how this site works.
    – Friedrich
    Commented Jun 27 at 9:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.