On Fri, 8 Sep 2006 at 9:24am, Bram Moolenaar wrote:
>
> Hari Krishna Dara wrote:
>
> > 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 don't know why {} works in Win32 Gvim. I don't really have time to
> figure it out. Perhaps someone else can dig into the code.
>
> > 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.
>
> This is documented: A full match is preferred over a partial match.
> Internally the ^ and $ are added to find a match, only if this fails
> they are left out. Thus if you _only_ want to find a full match you
> should add the ^ and $.
>
It will be helpful to add what you just said to the help on |bufname()|.
It does say a full match is preferred, but a new user has no way to
guess how to force a full match and that ^ and $ can be used in this
case (espceially that a |file-pattern| is expected and these are not
special in a |file-pattern|). Is it that ^ and $ can be used anywhere a
|file-pattern| is expected or only for bufname() and related functions
(like bufnr())?
--
Thanks,
Hari
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com