Split window automatically when opening 2 or 3 files

1 view
Skip to first unread message

Brock Henry

unread,
Dec 30, 2009, 4:37:43 PM12/30/09
to vim...@googlegroups.com
Hi,

I want to have Vim (on Windows), automatically split the window if I open two files (using right-click explorer integration - Open in Single VIM Window).

Actually, a new right-click integration that did this (Open in split VIM Window), would be perfect.

Is there anyway to do this?

Thanks, Brock

Ben Fritz

unread,
Dec 31, 2009, 10:58:39 AM12/31/09
to vim_use

You want to have Windows insert the -o or -O flags to Vim prior to the
file list. You can do this in a few places:

1. You can use a file association so that right-clicking on several
selected files and selecting "Open" will do what you want. This will
also let you double-click to open a single file in a new Vim. See
http://vim.wikia.com/wiki/Windows_file_associations for details.

2. You can use the Windows "Send To" menu to allow you to right-click
on one of the selected files and chose a command from the "Send To"
submenu. See http://vim.wikia.com/wiki/Add_Vim_to_Windows_Send_To_menu
for details.

3. You can find the registry entry that contols the "Edit files in
single Vim" context menu entry and edit that with regedit. I'm not
sure if we have a tip on this, I vaguely remember seeing something to
this effect.

Gary Johnson

unread,
Jan 3, 2010, 3:39:55 PM1/3/10
to vim...@googlegroups.com

I don't have a Windows machine handy at the moment so I can't test
this, but it seems to me that you should be able to test in your
_vimrc for the presence of more than one file name in the argument
list with the argc() function, then if the number of arguments is
greater than 1, execute ":all". See

:help argc()
:help :all

HTH,
Gary


Tony Mechelynck

unread,
Mar 1, 2010, 2:54:31 AM3/1/10
to vim...@googlegroups.com

Note that if you set 'winheight' to a high value in your vimrc in order
to make window sizes change dynamically (and the current window always
be the biggest one), you must use ":all" _before_ setting 'winheight',
otherwise it won't work.


Best regards,
Tony.
--
It is generally agreed that "Hello" is an appropriate greeting because
if you entered a room and said "Goodbye," it could confuse a lot of
people.
-- Dolph Sharp, "I'm O.K., You're Not So Hot"

Reply all
Reply to author
Forward
0 new messages