[EMAIL PROTECTED] wrote:
Hi, vimmers:

The line 1230 of editing.txt said:

To change to the directory of the current file:
        :cd %:h

This works for Vim 7.0 and before, but not for Vim 7.1. In Vim 7.1 when the
pwd is the same as the directory of current file, the command will fail
with E500. The failure will break the execution of a mapping, if one have a
mapping to do :cd %:h and then continue to do something else.

To reproduce the error, just at anytime, run :cd %:h twice. (I've got
Windows gvim7.1.1, cygwin console vim 7.1.1)

So there's at least two issues IMHO:
1. the line 1230 of editing.txt should be changed to :cd %:p:h
2. somewhere in the document should mention: if we had used :cd %:h in our
mappings or scripts, we should change them into %:p:h after upgraded to vim
7.1.

Or did I missed anything?
--
Sincerely, Pan, Shi Zhu. ext: 2606


I agree with point 1.

As for point 2, the way I remember it, ":cd %:h" and ":lcd %:h" already failed on Vim 6.3 or maybe earlier, if the current filename (as displayed e.g. on the status line) had no explicit path before it. So apparently one of us either missed something or remembered something the wrong way.

Note that ":cd" (without an argument) has different meanings on different OSes, thus reflecting the OS's idiosyncrasies: on Windows it is synonymous with ":pwd", on Linux with ":cd $HOME".


Best regards,
Tony.
--
"Here's something to think about:  How come you never see a headline like
`Psychic Wins Lottery'?"
                -- Jay Leno

Reply via email to