Gary Johnson <[EMAIL PROTECTED]> 写于 2007-05-17 00:35:42:
> On 2007-05-16, [EMAIL PROTECTED] wrote:
> > Gary Johnson <[EMAIL PROTECTED]> ???? 2007-05-16 16:41:22:
> > > On 2007-05-16, [EMAIL PROTECTED] wrote:
> > > > Hi, vimmers:
> > > >
> > > > The line 1230 of editing.txt said:
> > > >
> > > > To change to the directory of the current file:
> > > >         :cd %:h
> > > >
> I don't think disabling E500 would help.  The text of E500 is,
> "E500: Evaluates to an empty string".  That's warning you that there
> is no head component of the file name.  If you disabled the error,
> and presumably allowed %:h to return an empty string, then your ":cd
> %:h" command would be executing just ":cd", which on a Unix system
> changes to the home directory--not what you want.
>
> Another way to fix your mapping would be to use
>
>    :silent! cd %:h
>
> which allows the cd to fail silently.
>
> Regards,
> Gary
>
> --

You certainly are right, disabling E500 would not help. However:

> The line 1230 of editing.txt said:
>
> To change to the directory of the current file:
>         :cd %:h

If I was tell that a script could change to the directory of the current
file, I would think that it will always change to the directory of the
current file, and it is absurd to see it will give an error when the pwd is
already the directory of the current file.

I'm sure most average users will take it for granted if the document says
this. and they will not think the E500 is reasonable here. The document is
aprently misleading.

So, if :cd %:h must give E500 here, I think the document should change it
to :cd %:p:h

--
Sincerely, Pan, Shi Zhu. ext: 2606

Reply via email to