Loading ...
Sorry, an error occurred while loading the content.
 

Buffer FileName Issues

Expand Messages
  • Clint Harames
    Looking for help... GVIM on a WindowsXP machine shows the name of the file being edited as temp file (in the statusline), whereas GVIM on a Windows2000
    Message 1 of 2 , Jan 5, 2004
      Looking for help...
      GVIM on a WindowsXP machine shows the name of the file being edited as
      \temp\file (in the statusline), whereas GVIM on a Windows2000 machine
      shows the same filename as temp\file (notice no leading \).

      This is significant because I use a key mapping to diff two buffers with
      an external program. It passes the buffer name (filename) using %. So
      in the case above the shell command executed is:
      Diff "\temp\file1" "\temp\file2"
      This is a problem because Windows does not know that the leading \ means
      to start from the root directory. It results in a file not found error.

      The same mapping (from same .vimrc) works fine on a Windows2000 machine
      because the buffer filename passed to the command line looks like this:
      Diff "temp\file1" "temp\file2"

      In case it is helpful, here is the key mapping from my .vimrc:
      map <C-F6> <C-W>w:let @9=@%^M<C-W>W:!diff "<C-R>%" "<C-R>9"<CR><CR>

      Also, I've noticed a difference between the right-mouse-click invoking
      of VIM on XP and 2000. I think it is related to the \ being put on the
      front of the buffer filename.

      If I right-mouse-click invoke VIM on XP and do :pwd the machine (gvim)
      returns:
      C:\Program Files\Common Files\System\MAPI\1033

      But the 2000 machine returns:
      C:\

      Therefore, I think the buffer filename on the 2000 machine does not get
      the \ pre-pended because the file name is already relative to root,
      whereas on the XP machine right-click invoking GVIM starts execution
      from a path OTHER than root. I believe this is a bug, but someone that
      has more brain power than I will need to confirm/resolve.

      I've duplicated my installation on both machines to assure it is not
      where or how GVIM was installed. I believe it is something beyond my
      control (in the source code or platform compile options).

      Anyone have any hints or suggestions?
      Thanks,
      -Clint
    • Keith Roberts
      ... or the like should solve this problem. Then it doesn t matter whether the bufname is a relative pathname or not, or in what form it is presented.
      Message 2 of 2 , Jan 6, 2004
        >-----Original Message-----
        >From: Clint Harames [mailto:c.harames@...]
        >Sent: Monday, January 05, 2004 5:20 PM
        >To: vim-dev@...
        >Subject: Buffer FileName Issues
        >
        >Looking for help...
        >GVIM on a WindowsXP machine shows the name of the file being edited as
        >\temp\file (in the statusline), whereas GVIM on a Windows2000 machine
        >shows the same filename as temp\file (notice no leading \).
        >
        >This is significant because I use a key mapping to diff two buffers with
        >an external program. It passes the buffer name (filename) using %. So
        >in the case above the shell command executed is:
        >Diff "\temp\file1" "\temp\file2"
        >This is a problem because Windows does not know that the leading \ means
        >to start from the root directory. It results in a file not found error.
        >[snip]

        :exe "Diff" expand('%:p') expand('#:p')

        or the like should solve this problem. Then it doesn't matter whether the
        bufname is a relative pathname or not, or in what form it is presented.
      Your message has been successfully submitted and would be delivered to recipients shortly.