I just finished troubleshooting a problem that had several 
contributing factors, one of which was the way Vim's mch_FullName() 
function behaves with ClearCase versioned file names.

If you open a file under ClearCase using the full path name and a 
version extension, e.g.,

    /project/xyz/system/src/bar.c@@/main/42

Vim will ask mch_FullName() for the full name of that file.
mch_FullName() will then extract everything to the left of the last
'/' as the directory containing the file and chdir() to that
directory, e.g.,

    chdir("/project/xyz/system/src/bar.c@@/main")

mch_FullName() then calls getcwd() to determine the operating
system's name for that directory, which from ClearCase is

    /view/garyjohn_main@@/project/xyz/system/main/5/src/main/2/bar.c/main

mch_FullName() then puts back the trailing "file name" of "42" in
this case and returns the full file name as

    /view/garyjohn_main@@/project/xyz/system/main/5/src/main/2/bar.c/main/42

This is the name that is then given to the buffer used for that file
and which appears in the status line.

This is a valid file name which points to the correct file and works
with most external commands.  However, it does not work with those
external commands or Vim autocommands whose behavior depend on the
file name suffix.  It's also really ugly in the status line.

I've used autocommands like this one,

    au BufRead *@@/main* exe "doau BufRead " .
        \ strpart(expand("<afile>"),0,stridx(expand("<afile>"),"@@"))

to solve the problem of getting filetype.vim to recognize the file
types of version-extended file names, but I haven't been able to
come up with anything that will force Vim to use the
version-extended file name for the buffer name when the full path to
the file is given.

Sd does anyone here have any thoughts on this, such as an
autocommand or an alternative implementation of mch_FullName()?

Regards
Gary

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

Reply via email to