:buffers -- I'm probably doing something wrong ;)

35 views
Skip to first unread message

Kennedy, Marcus A.

unread,
May 4, 2020, 3:52:08 PM5/4/20
to vim...@googlegroups.com

Hi All,

 

Hope you are all maintaining sanity with day 3,592,487 of quarantine.

 

A question about :buffers.  :buffers shows the buffers that are

available within a given session.  In my case, I open my vim with the

command:

 

vim -O3 $(find -name '*.h') $(find -name '.*c') $(find -name '*.cpp')

 

I then cycle through my various buffers with :buf <somefile>.  Today,

something is wrong.  I've got a file bc.h. So, I do

 

:buf bc.h

 

and I get back "E93: More than one match for bc.h".  So, I think, hmm,

wonder what I did.  I'll look at the buffers.  But, I have more than 75

buffers on the command line.  When I go to see why I have duplicate bc.h

files, I cannot find them due to the number of buffers.  Unfortunately,

if I press any key, the buffers window exits and I cannot see anything.

I've done some searching on the web but cannot find the correct way to

scroll through the buffers list.

 

What is the correct way to scroll the buffers list?

 

Thanks,

Andy

Dominique Pellé

unread,
May 4, 2020, 6:03:07 PM5/4/20
to Vim List
Kennedy, Marcus A. <Marcus....@rocket.com> wrote:

> :buf bc.h
>
> and I get back "E93: More than one match for bc.h". So, I think, hmm,
> wonder what I did. I'll look at the buffers. But, I have more than 75
> buffers on the command line. When I go to see why I have duplicate bc.h
> files, I cannot find them due to the number of buffers. Unfortunately,
> if I press any key, the buffers window exits and I cannot see anything.
> I've done some searching on the web but cannot find the correct way to
> scroll through the buffers list.
>
> What is the correct way to scroll the buffers list?

When looking at buffers with :ls you can scroll with
the keys f and b (forward & backward).

But more efficient in your case would be to do:

:filter /bc.h/ ls

... which will filter the :ls command to show only result
matching the regex bc.h

Regards
Dominique

Tony Mechelynck

unread,
May 5, 2020, 6:15:53 AM5/5/20
to vim_use
On Tue, May 5, 2020 at 12:03 AM Dominique Pellé
<dominiq...@gmail.com> wrote:
>
> Kennedy, Marcus A. <Marcus....@rocket.com> wrote:
>
> > :buf bc.h
> >
> > and I get back "E93: More than one match for bc.h". So, I think, hmm,
> > wonder what I did. I'll look at the buffers. But, I have more than 75
> > buffers on the command line. When I go to see why I have duplicate bc.h
> > files, I cannot find them due to the number of buffers. Unfortunately,
> > if I press any key, the buffers window exits and I cannot see anything.
> > I've done some searching on the web but cannot find the correct way to
> > scroll through the buffers list.
> >
> > What is the correct way to scroll the buffers list?
>
> When looking at buffers with :ls you can scroll with
> the keys f and b (forward & backward).
>
> But more efficient in your case would be to do:
>
> :filter /bc.h/ ls

Since the pattern is a Vim search pattern (not a shell glob pattern)
the dot should be backslash-escaped. I would try

:filter /\<bc\.h\>/ ls

>
> ... which will filter the :ls command to show only result
> matching the regex bc.h
>
> Regards
> Dominique

Best regards,
Tony.

Ed Blackman

unread,
Sep 8, 2020, 11:48:15 AM9/8/20
to vim...@googlegroups.com
On Mon, May 04, 2020 at 07:51:46PM +0000, Kennedy, Marcus A. wrote:
> I then cycle through my various buffers with :buf <somefile>. Today,
> something is wrong. I've got a file bc.h. So, I do
>
> :buf bc.h
>
> and I get back "E93: More than one match for bc.h".
[...]
> What is the correct way to scroll the buffers list?

Sorry for the late response, but while you did get answers about
scrolling and filtering the buffer list, I thought I'd mention one more
option.

If you enter ":buf bc.h" and then press <Tab>, Vim will tab complete to
the full path of the first buffer matching that substring, if any. The
substring does *not* appear to be treated as a regex.

If there is more than one match, pressing <Tab> will cycle through them
in buffer order, cycling back to what you typed (to let you easily
change it?), and then back through the matches in order.

--
Ed Blackman
Reply all
Reply to author
Forward
0 new messages