Reputation: 59202
If I'm editing a file in vim, and I want to create a vertical split and open a new file in the right-hand side of the split, is there a way to do that with a single command? If I do:
:vsp filename.txt
Then it opens the file in the left-hand side of the split.
Upvotes: 69
Views: 36993
Reputation: 2384
Well, we used to
:vsp filename.txt
to open another window in vim. Then you can use
ctrl+w r
to swap the two window
Upvotes: 24
Reputation: 25144
Use
:botright vnew filename.txt
As seen in http://technotales.wordpress.com/2010/04/29/vim-splits-a-guide-to-doing-exactly-what-you-want/
Upvotes: 11
Reputation: 196556
:bo[tright] vs filename
does what you want.
You can add the two lines below to your ~/.vimrc
to make that the default behavior:
set splitbelow
set splitright
Upvotes: 45
Reputation: 20456
You can set the following to open new split panes to right
:set splitright
Upvotes: 97