juanjux
juanjux

Reputation: 641

How to move or create a window on the right side on Vimscript?

I'm trying to modify project.vim to open the project window on the right side instead of in the left. I see several references in the source to "vertical new", "vertical split" and "vertical resize". Trying them I see that a new vertical split is opened to the left, but I can't find how can I make a new vertical split open (or move) to the right side. I know the command Control-W + r will move the window to the right, but I don't know how this is done using vimscript.

Upvotes: 5

Views: 3150

Answers (3)

too much php
too much php

Reputation: 91028

You can also set splitright so that vertically split windows are always created on the right hand side.

Update:

It seems the plugin is coded quite inflexibly, so you'll need to take one of two approaches:

1) Change this line in the plugin's source code

let b:proj_locate_command='silent! wincmd H'

to

let b:proj_locate_command='silent! wincmd L'

or 2) For whichever mappings you use to open the project window, append <C-W>L or :wincmd L to the end of the mappings.

You should also email the author and ask for him/her to provide a way to configure this behaviour more easily.

Upvotes: 2

ZyX
ZyX

Reputation: 53614

Maybe you should consider using wincmd r after doing a vertical split. <C-w>c and wincmd c most of time are equivalent.

Upvotes: 1

Randy Morris
Randy Morris

Reputation: 40927

Try changing vertical new to rightbelow vertical new.

Also, see :help vertical and all the friends listed just after it.

Upvotes: 5

Related Questions