I've been kluging an old version of BufExplorer plugin to trim down
displayed paths when invoked by different gvim versions (Solaris,
Windows, and Cygwin).  Without such trimming, BufExplorer might
display:

  5 %    Temp.txt c:\cygwin\home\Administrator\Temp
  1 #    diff.out c:\cygwin\home\Administrator\Temp

I've managed to cobble the code so that in Solaris and Cygwin, it is
displayed as

  5 %    Temp.txt ~\Temp
  1 #    diff.out ~\Temp

However, I'm having some trouble making the code work with Windows vim
7.2.  Currently, I am using the code:

   let _cfile = _cfile." ".substitute(
      \ expand("#"._cnr.":p:h"),
      \ "[Cc]:\\cygwin\\home\\".$USERNAME, "~", "g" )

Here, _cfile is the basename of the file path before the statement is
excuted.  This code doesn't do anything.  As a debugging test,
however, this "works":

   let _cfile =
      \ _cfile." ".substitute( expand("#"._cnr.":p:h"),
      \ "c:\\", "~", "g" )

It works in the sense that "c:\" in the file path is replaced by "~".
This test "works" too:

   let _cfile =
      \ _cfile." ".substitute( expand("#"._cnr.":p:h"),
      \ "cygwin", "~", "g" )

It works in the sense that "cygwin" is replaced by "~".

Strangely enough, the combination of the above two tests does not
work:

   let _cfile =
   \ _cfile." ".substitute( expand("#"._cnr.":p:h"),
   \ "c:\\cygwin", "~", "g"

I am partly using this exercise as a prompt to get to know vim
scripting better.  Could someone please advise on what might be the
problem, and where I can dig up more about its resolution?

Thanks.
--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Reply via email to