The version of _vimrc installed by the Cream vim "without Cream"
installer appears to be an obsolete version and contains a MyDiff()
that doesn't work.

I recently installed vim-7.2.303 from the "without Cream" download
page, http://sourceforge.net/projects/cream/files/Vim, onto a device
running Windows XP.  I needed a better editor than Notepad, but I
didn't want to install all my usual Vim customizations, so I just
stuck with the default _vimrc.

That worked OK until I tried diffing a pair of buffers.  Executing

    :windo diffthis

resulted in

    Error detected while processing function MyDiff:
    line    4:
    E10: \ should be followed by /, ? or &
    E810: Cannot read or write temp files
    E97: Cannot create diffs

Here is MyDiff() from that _vimrc:

    function MyDiff()
        let opt = ''
        if &diffopt =~ 'icase' | let opt = opt . '-i ' | endif
        if &diffopt =~ 'iwhite' | let opt = opt . '-b ' | endif
        silent execute '\"!C:\Program Files\vim\diff\" -a ' . opt . v:fname_in 
. ' ' . v:fname_new . ' > ' . v:fname_out
    endfunction

Among other problems, it tries to execute a file that doesn't exist:
diff.exe is in the vim\vim72 directory, not in the vim directory.

I replaced that _vimrc with the one that came with the original
vim-7.2 package from vim.sf.net (2008-08-11) and which has this
version of MyDiff() instead:

    function MyDiff()
      let opt = '-a --binary '
      if &diffopt =~ 'icase' | let opt = opt . '-i ' | endif
      if &diffopt =~ 'iwhite' | let opt = opt . '-b ' | endif
      let arg1 = v:fname_in
      if arg1 =~ ' ' | let arg1 = '"' . arg1 . '"' | endif
      let arg2 = v:fname_new
      if arg2 =~ ' ' | let arg2 = '"' . arg2 . '"' | endif
      let arg3 = v:fname_out
      if arg3 =~ ' ' | let arg3 = '"' . arg3 . '"' | endif
      let eq = ''
      if $VIMRUNTIME =~ ' '
        if &sh =~ '\<cmd'
          let cmd = '""' . $VIMRUNTIME . '\diff"'
          let eq = '"'
        else
          let cmd = substitute($VIMRUNTIME, ' ', '" ', '') . '\diff"'
        endif
      else
        let cmd = $VIMRUNTIME . '\diff'
      endif
      silent execute '!' . cmd . ' ' . opt . arg1 . ' ' . arg2 . ' > ' . arg3 . 
eq
    endfunction

With that _vimrc, the diff I was trying to execute works fine.

Regards,
Gary


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

Raspunde prin e-mail lui