Thanks for a meaty reply Tony, plenty for me to read up on.

Just one minor related issue: what is the convention of handling "~"
in Vim under Windows?  The problem is that under WinXP, when I use
$HOME in Vim, it gets translated to "~" (i.e., the Unix convention for
home directory), rather than the full absolute path.  Yet at the same
time it seems to me that Vim does not treat "~" as a home directory
here, as :find does not find stuff if my path is set to "~/src" (which
I originally set to "$HOME/src").  Since there are no spaces in
"~/src", I don't think there's any escaping to do, hence this
should've worked if Vim internally expanded out the tilde.

Oh, one other minor one: under Windows, are "\" and "/" *always*
interchangeable in Vim as path seperators, or are there instances
where you must use the Windows backslash convention? I ask because I
thought I read in the manual that they are interchangeable, yet having
exchanged them I was seeing different results.  I suspect the issue
was my improper escaping of the backslashes, but I'd like to eliminate
this one potential source of error before going on to debug...

On 27/06/06, A.J.Mechelynck <[EMAIL PROTECTED]> wrote:
        :let escaped_home = escape(substitute($HOME,'/','\\',''),' ')
        :let &path = escaped_home . '\src'
        :let &path .= ',' . escaped_home . '\include'
etc.

See under ":help 'path'", the paragraph starting "Spaces can also" about
using the ":set" command to set a 'path' with spaces in it. ":set
option=foo\\\ bar" is equivalent to ":let &option = 'foo\ bar'". If
$HOME contains spaces, you must backslash-escape them, either manually
like you did, or by using the escape() function as shown above.

Alternately, you can use the short name of the $HOME directory, which
has no spaces in it (because spaces are forbidden in short names):

        :let short_home = 'C:\DOCUME~1\User\MYDOCU~1\Home'
        :exe "set path=" . short_home . '\src'
        :exe "set path+=" . short_home . '\include'
etc.

Note the difference between single and double quotes in Vim: 'foo\ bar'
is equivalent to "foo\\ bar" and its value has one backslash in it.

Reply via email to