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 > > 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)
I would expect ":cd %:h" to give an error the second time it is executed. Just to be sure, I repeated your experiment on 7.1, 7.0 and 6.4 on Unix and 7.0 on Windows. I always got E500. Are you sure that it "works" for you for Vim 7.0? > So there's at least two issues IMHO: > 1. the line 1230 of editing.txt should be changed to :cd %:p:h I disagree. If you want to _change_ directory to that of the current file, the command ":cd %:h" is correct. If the working directory is already that of the current file, such that executing ":cd %:h" would give E500, then there is no reason to change directory. > 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. I don't see that this behavior has changed. Regards, Gary -- Gary Johnson | Agilent Technologies [EMAIL PROTECTED] | Mobile Broadband Division | Spokane, Washington, USA