On 2006-07-26, Cory Echols <[EMAIL PROTECTED]> wrote:
> On 7/26/06, Gary Johnson <[EMAIL PROTECTED]> wrote:
> > I tried using 'cdpath' on Windows and it seems to be broken, but I
> > don't know for sure since I've never used it before.  From the
> > Command Prompt I execute
> >
> >     gvim -N -u NONE
> >
> > Then within gvim,
> >
> >     :set cdpath?
> >       cdpath=,,
> >     :pwd
> >     C:\Documents and Settings\garyjohn
> >     :cd Desktop
> >     C:\Documents and Settings\garyjohn\Desktop
> >
> > So far, so good.  Now,
> >
> >     :set cdpath+=C:\\Documents\ and\ Settings\\garyjohn
> >     :set cdpath?
> >       cdpath=,,,~/
> >     :cd /
> >     C:\
> >     :cd Desktop
> >     E344: Can't find directory "Desktop" in cdpath
> >     E472: Command failed
> >     Press ENTER or type command to continue
> >
> > That looks like a bug to me, or am I missing something?  I'm using
> > Vim 7.0, no patches, obtained from sf.vim.net, and Windows XP.
> 
> In general, I find setting options involving file paths to be a pain
> on windows machines, because it seems to require more backslash
> escapes than is intuitive to me.  I was able to get a situation
> similar to yours to work though:
> 
> For a directory named "C:\With Spaces\Target":
> 
> :set cdpath=c:\\With\\\ Spaces
> :cd Target
> :pwd
> c:/With Spaces/Target
> 
> I find the 'let' command to be less cumbersome for path-type options on 
> windows:
> 
> :let &cdpath='c:\With\ Spaces'
> :set cdpath?
>  cdpath=c:\With\ Spaces
> :cd Target
> :pwd
> c:/With Spaces/Target
> 
> Hope this helps.

Wow.  That works.  But it makes no sense to me that it does.

    gvim -N -u NONE

    :set cdpath+=C:\\Documents\\\ and\\\ Settings\\garyjohn
    :set cdpath?
      cdpath=,,,C:\Documents\ and\ Settings\garyjohn
    :cd /
    C:\
    :cd Desktop
    C:\Documents and Settings\garyjohn\Desktop

In my first example, 'cdpath' "knew" that "C:\\Documents\ and\ 
Settings\\garyjohn" was equivalent to HOME since it displayed its 
value as "cdpath=,,,~/".  Yet in that case, ":cd Desktop" didn't 
work.  Yet in my second example, following your suggestion, 'cdpath' 
does not appear to "think" that "C:\\Documents\\\ and\\\ 
Settings\\garyjohn" is anything special, yet ":cd Desktop" works in 
that case.

Note that

    :cd ~
    C:\Documents and Settings\garyjohn

and

    cd ~/Desktop
    C:\Documents and Settings\garyjohn\Desktop

both work from any working directory and with the default 'cdpath'.

Another thing that seems broken in my second example is that the 
value of 'cdpath' that works is given as

      cdpath=,,,C:\Documents\ and\ Settings\garyjohn

Here, the backslashes in front of letters are taken as path 
separators while those in front of spaces are taken as escapes for 
the spaces.  I've never known vim to be that inconsistent.  The 
Command Prompt doesn't understand that to be valid syntax, either:

    C:\> cd C:\Documents\ and\ Settings\garyjohn
    The system cannot find the path specified.

Thank you for the "solution", but I still think the 'cdpath' 
mechanism is broken.

Regards,
Gary

-- 
Gary Johnson                 | Agilent Technologies
[EMAIL PROTECTED]     | Wireless Division
                             | Spokane, Washington, USA

Reply via email to