Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

gVIM: open multiple files?

472 views
Skip to first unread message

theukrainian

unread,
Dec 27, 1999, 3:00:00 AM12/27/99
to
hello,

Many programs let me go File->Open and then
select multiple file names with my mouse(hold down shift or
control), and open them all at the same time, in different buffers.

Is there any way to do something like that in gVIM? I would LOVE
for it to open multiple files tiled together in text buffers.
If there is no way to tile, I would at least like for them
to all be open one behind the other.

Any info will be greatly appreciated.
thanks.


denis

* Sent from RemarQ http://www.remarq.com The Internet's Discussion Network *
The fastest and easiest way to search and participate in Usenet - Free!


theukrainian

unread,
Dec 27, 1999, 3:00:00 AM12/27/99
to
That works. However, do you know of a way to open
multiple files at the same time. Say, I would like to open
5 files from some directory. I would like to do something
like ":browse e" and highlight many files, and have all
of them open, as opposed to doing this ":e" thing
for each file.

Thanks anyway. I did not know about :bn or :bl since I never
really use them, but they are quite convenient

denis

> I have mine set to hide windows, so all I do is
> :e <filename>
> and the file is loaded. To move from file to file, use
> :bn
> or
> :bl
> (buffer next, buffer last).
>
> -------------------------------------------------------------
> - Len Philpot -> lphi...@centurytel.net (personal)
> ---------------> len.p...@cleco.com (work)
> ---------------> http://www.centuryinter.net/lphilpot/ (web)

Len Philpot

unread,
Dec 28, 1999, 3:00:00 AM12/28/99
to
On Mon, 27 Dec 1999 14:43:06 -0800, theukrainian
<theukraini...@hotmail.com.invalid> wrote:

>>hello,
>>
>>Many programs let me go File->Open and then
>>select multiple file names with my mouse(hold down shift or
>>control), and open them all at the same time, in different buffers.
>>
>>Is there any way to do something like that in gVIM? I would LOVE
>>for it to open multiple files tiled together in text buffers.
>>If there is no way to tile, I would at least like for them
>>to all be open one behind the other.
>>

I have mine set to hide windows, so all I do is

T.E.Dickey

unread,
Dec 28, 1999, 3:00:00 AM12/28/99
to
Len Philpot <lphi...@centurytel.net> wrote:

> I have mine set to hide windows, so all I do is

(in short, your answer is "no")

--
Thomas E. Dickey
dic...@clark.net
http://www.clark.net/pub/dickey

Richard Slobod

unread,
Dec 28, 1999, 3:00:00 AM12/28/99
to
In article <0f5b83e7...@usw-ex0101-003.remarq.com>,
theukrainian <theukraini...@hotmail.com.invalid> wrote:

> Many programs let me go File->Open and then
> select multiple file names with my mouse(hold down shift or
> control), and open them all at the same time, in different buffers.
>
> Is there any way to do something like that in gVIM? I would LOVE
> for it to open multiple files tiled together in text buffers.
> If there is no way to tile, I would at least like for them
> to all be open one behind the other.

The only way I know of to get Vim to open multiple files at once in
tiled windows is to do it at startup on the command line:

gvim -o file1 file2 file3

(leaving out the "-o" would give you the "one behind the other" effect).

The only way I know of to get Vim to open multiple files at once when
it's already running is via the :n command:

:n file1 file2 file3

but there unfortunately appears to be no way to get the "-o" effect with
that command, so you can only get it to do "one behind the other".

(Also, in both cases, when opening the files "one behind the other",
note that each file is not really opened until you visit its buffer,
although they do all immediately show up in the buffer list.)


Sent via Deja.com http://www.deja.com/
Before you buy.

robert

unread,
Dec 29, 1999, 3:00:00 AM12/29/99
to
Richard Slobod <7123...@compuserve.com>:
>:n file1 file2 file3

Try :new file1 (it's not possible to open multiple files at once with this,
though).

robert

Thomas Köhler

unread,
Dec 29, 1999, 3:00:00 AM12/29/99
to
Richard Slobod <7123...@compuserve.com> wrote:
> In article <0f5b83e7...@usw-ex0101-003.remarq.com>,
> theukrainian <theukraini...@hotmail.com.invalid> wrote:
>
> > Many programs let me go File->Open and then
> > select multiple file names with my mouse(hold down shift or
> > control), and open them all at the same time, in different buffers.
> >
> > Is there any way to do something like that in gVIM? I would LOVE
> > for it to open multiple files tiled together in text buffers.
> > If there is no way to tile, I would at least like for them
> > to all be open one behind the other.
>
> The only way I know of to get Vim to open multiple files at once in
> tiled windows is to do it at startup on the command line:
>
> gvim -o file1 file2 file3
>
> (leaving out the "-o" would give you the "one behind the other" effect).
>
> The only way I know of to get Vim to open multiple files at once when
> it's already running is via the :n command:
>
> :n file1 file2 file3
>
> but there unfortunately appears to be no way to get the "-o" effect with
> that command, so you can only get it to do "one behind the other".

Try this:
:args file1 file2 file3
:sall

:help :sall

> (Also, in both cases, when opening the files "one behind the other",
> note that each file is not really opened until you visit its buffer,
> although they do all immediately show up in the buffer list.)

True.

CU,
Thomas

--
Thomas Köhler Email: jean...@picard.franken.de | LCARS - Linux for
<>< WWW: http://home.pages.de/~jeanluc/ | Computers on All
IRC: jeanluc | Real Starships
PGP public key: http://www.mayn.de/users/jean-luc/PGP-Public.asc

Dr. Charles E. Campbell

unread,
Dec 30, 1999, 3:00:00 AM12/30/99
to
In article <84besc$lbk$1...@nnrp1.deja.com>,

Richard Slobod <7123...@compuserve.com> wrote:
>The only way I know of to get Vim to open multiple files at once when
>it's already running is via the :n command:
>
>:n file1 file2 file3
>
>but there unfortunately appears to be no way to get the "-o" effect with
>that command, so you can only get it to do "one behind the other".

Here's a map and a Vim function that will do the -o effect
from within Vim:

map \win :call Windowize()<CR>
" Windowize: see \win (makes multiple buffers into multiple windows)
fu! Windowize()
let n=1
let nmax=bufnr('$')
while n < nmax
new|n
let n=n+1
echo "n=" . n
" exec ':edit '.bufname(n)
endw
endf

Regards,
Dr C
--
Charles E Campbell, Jr, PhD _ __ __
Goddard Space Flight Center / /_/\_\_/ /
c...@NgrOyphSon.gPsfAc.nMasa.gov /_/ \/_//_/
PGP public key: http://www.erols.com/astronaut/pgp.html/

Scott Burke

unread,
Dec 31, 1999, 3:00:00 AM12/31/99
to
On Mon, 27 Dec 1999 23:01:00 -0800, theukrainian
<theukraini...@hotmail.com.invalid> wrote:

>That works. However, do you know of a way to open
>multiple files at the same time. Say, I would like to open
>5 files from some directory. I would like to do something
>like ":browse e" and highlight many files, and have all
>of them open, as opposed to doing this ":e" thing
>for each file.

I don't know how to do it from gvim, but under windows
you can create a shortcut with "%L" as the only parameter
to the program (ie. 'c:\vim\vim55\gvim.exe "%L" ') and put
that in your c:\windows\sendto folder; then to edit multiple
files, select them, then right click on them and select
SendTo | gVim -- it will open them all in gvim (:sball of
course to open windows for all of them).

Darin McGill

unread,
Dec 31, 1999, 3:00:00 AM12/31/99
to
Hi,
I'm using gvim in windows, and I want to set up menus in my
_vimrc. This requires I do something like
menu File.&next :n^M
The thing is, although I can cut and paste a ctrl-M while in gvim, I can't
make this work in the _vimrc properly. Does anyone know how I do this?
Thanks, Darin
(da...@ocf.berkeley.edu)

David de Gruyl

unread,
Dec 31, 1999, 3:00:00 AM12/31/99
to
Darin McGill wrote:

>Hi,
> I'm using gvim in windows, and I want to set up menus in my
>_vimrc. This requires I do something like
>menu File.&next :n^M
>The thing is, although I can cut and paste a ctrl-M while in gvim, I can't
>make this work in the _vimrc properly. Does anyone know how I do this?

you can type in <Ctrl-v><Enter> which will put the actual control
character in the file.


--
David de Gruyl <deg...@superlink.net>
If you want to program in C, program in C. It's a nice language. I
use it occasionally... :-)
-- Larry Wall in <75...@jpl-devvax.JPL.NASA.GOV>

Stan Brown

unread,
Jan 3, 2000, 3:00:00 AM1/3/00
to
With just about 12 months remaining in the millennium,
da...@ocf.Berkeley.EDU (Darin McGill) wrote in comp.editors:

> I'm using gvim in windows, and I want to set up menus in my
>_vimrc. This requires I do something like
>menu File.&next :n^M
>The thing is, although I can cut and paste a ctrl-M while in gvim, I can't
>make this work in the _vimrc properly. Does anyone know how I do this?

Sure: use the four characters <cr>. Most special keys can be represented
this way. See :h keycodes for details.

--
Stan Brown, Oak Road Systems, Cleveland, Ohio, USA
http://www.mindspring.com/~brahms/
My reply address is correct as is. The courtesy of providing a correct
reply address is more important to me than time spent deleting spam.

Stan Brown

unread,
Jan 3, 2000, 3:00:00 AM1/3/00
to
With just about 12 months remaining in the millennium,
theukraini...@hotmail.com.invalid (theukrainian) wrote in
comp.editors:

>That works. However, do you know of a way to open
>multiple files at the same time. Say, I would like to open
>5 files from some directory.

Works just fine for me. In my Send To directory I have a shortcut to the
GVim executable, and the Target line of that shortcut is
%vimruntime%\GVIM.EXE "%1"
(Yes, you can put environment variables in Target lines.)

I've just now tried highlighting several files, right-clicking and
selecting Send To... Vim, and the files were opened in different buffers
that I could access by :n and :N.

(I'm assuming you're running Win95 or Win98. Unless I missed it, you
didn't say.)

Bipin Sehgal

unread,
Jan 6, 2000, 3:00:00 AM1/6/00
to
This does not work for me. It either gives SEGV error and makes my xterm
window very tiny or core dumps........ I tried

:win 1 3 4
and
:win n 1 2 3

............ unless I am missing something !

--
Bipin Sehgal
Graduate Student
Department of Aero & Astro Engg
Univ of Illinois at Urbana-Champaign

(Office) (Apartment)
306, Talbot Laboratory 510 E. Stoughton Street
104 South Wright Street Apt #311
Urbana. IL 61801 Champaign. IL 61820

(217) 333 8580 (217) 355 0365

Bill McCarthy

unread,
Jan 8, 2000, 3:00:00 AM1/8/00
to
On Thu, 06 Jan 2000 01:47:39 -0600, Bipin Sehgal wrote:
>This does not work for me. It either gives SEGV error and makes my
>xterm window very tiny or core dumps........ I tried
>
>:win 1 3 4
>and
>:win n 1 2 3
>
>............ unless I am missing something !

Well yes. You're misusing the winsize command.

Just load (:so) the function and map you quoted by Charles. They run
it by typing \win quickly.

Bill

0 new messages