Bram,

I asked a couple of questions below, but I solved the last one
('ignorecse') by implementing a filter() myself, so it is not an issue.
The other question is on why "{}" works on win32 GVIM (7.0 version
compiled by you) is not important, though a confirmation that yes, that
is supposed to work will be great. It can then also be documented to
avoid confurion in the future (as this works on posix platforms also, it
might be important for someone to know what characters are special and
need escaped in some situations).

I have another question related to this. According to the help on
|file-pattern|, there is no significance for "^" and "$" characters, but
I have been using them with bufnr() to be able to do an exact match on
filenames. I have a suspicion that they were suggested by you when I had
a question on how to restrict bufnr() to do this exact match (probably
about 5 years ago). The function is defined like this:

function! s:FindBufferForName(fileName)
  let fileName = genutils#Escape(a:fileName, '[?,{')
  let _isf = &isfname
  try
    set isfname-=\
    set isfname-=[
    let i = bufnr('^' . fileName . '$')
  finally
    let &isfname = _isf
  endtry
  return i
endfunction

It has been working great, but since I am using what seem like
undocumented features, I just wanted your perusal on my usage, as well
as getting it documented such that this will not be broken in a future
change.

PS: Please note that Vim has otherwise no primitives to find an exact
match for buffers given its name, other than enumerating all the
buffers, so functionality of the above is very important for several of
my plugins (at least for me).

-- 
Thank you,
Hari

On Tue, 29 Aug 2006 at 1:31pm, Hari Krishna Dara wrote:

>
> On Tue, 29 Aug 2006 at 10:06pm, Bram Moolenaar wrote:
>
> >
> > Hari Krishna Dara wrote:
> >
> > > > > The help on glob() or globpath() don't indicate what type of
> > > > > metacharacters are accepted, but there is a separate section called
> > > > > |file-pattern| that describes the metacharacters used for filename
> > > > > matching for autocommands. I don't know if these are applicable for
> > > > > glob() and globpath() as well, but a lot of these don't seem to work
as
> > > > > described. Is there a different section that I am missing to see, or
is
> > > > > it completely left out? Are the metacharacters predictable, or
dependent
> > > > > on the platform and environment? If so, is there a base set that
could
> > > > > work on all?
> > > > >
> > > > > The reason I am asking is that I would like to translate a
> > > > > filename-pattern to a Vim regex-pattern such that I can highlight the
> > > > > part of the filename that matched the filename-pattern, after getting
> > > > > the results from glob() or globpath(), so I need to know all the
> > > > > supported chars.
> > > >
> > > > glob() should work as described at ":help wildcard".  There are
> > > > small differences depending on the system.
> > >
> > > Thanks Bram. This covers "**" as well, but doesn't mention most of the
> > > other wildcards that are applicable for |file-pattern|, which makes
> > > sense. I was however surprised to see "{}" working to group patterns and
> > > "," working to separate patterns with in them. Is this something extra
> > > for windows and undocumented?
> >
> > For Unix the {} things are detected and then expansion is done by the
> > shell.  I don't see how {} things can work on MS-Windows.  Perhaps you
> > compiled with Cygwin?
>
> I have a win32 version:
>
> VIM - Vi IMproved 7.0 (2006 May 7, compiled May  7 2006 16:23:43)
> MS-Windows 32 bit GUI version with OLE support
> Compiled by [EMAIL PROTECTED]
>
> >
> > > It is also strange that the [abc] wildcard
> > > always matches as if 'ignorecase' is turned on. Is there a way to force
> > > a 'noignorecase' on windows?
> >
> > On MS-Windows case of file names is always ignored.
>
> Is this because the underlying library function that glob() uses doesn't
> care about the case? If this is in the control of Vim, it is useful to
> support 'noignorecase' or something equivalent. Even though the
> filesystem itself ignores the case, it still preserves it, and as a
> user, most developers do care about the case (in fact, it is important
> in most areas of Java/JSP world).
>
>

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

Reply via email to