On 12/08/13 23:44, Gary Johnson wrote:
On 2013-08-12, Tony Mechelynck wrote:
On 12/08/13 22:10, Gary Johnson wrote:
On 2013-08-12, Tony Mechelynck wrote:

No. Your _vimrc is not part of the Vim installation.

That's not true.  On Windows, at least prior to Vim 7.4, _vimrc _is_
part of the Vim installation.  MyDiff() is/was part of the standard
_vimrc installed under C:\Program Files\Vim (the XP path).

Installing a _vimrc for you the first time is an option, and the
installer does it IIRC by copying the vimrc_example.vim, which leaves
you in the cold if a later version of Vim comes with a different
vimrc_example.vim.

The last time I installed Vim for Windows (from the Cream site) was
around the first of the year and this was the file installed in
C:\Program Files\vim\_vimrc (i.e., $VIM/_vimrc):

     set nocompatible
     source $VIMRUNTIME/vimrc_example.vim
     source $VIMRUNTIME/mswin.vim
     behave mswin

     set diffexpr=MyDiff()
     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

I don't understand the "else" branch of that ":if &sh =~" conditional. If not using a "cmd" shell, «Program Files (x86)» will become «Program" Files (x86)» :-???

You will have to change those arg1 arg2 arg3, in 7.4 they have become something else. If you want a vimrc that will work with versions old and new you will have to try both, either with ":if exists" or with a try block (a feature which, however, was new in 6.2).

It is not a copy of vimrc_example.vim, it sources vimrc_example.vim.
And it defines MyDiff().  So, one is not left in the cold by later
changes to vimrc_example.vim, but one is by later changes to
MyDiff().

OK, so at least that has changed since I was on Windows several years ago. It still sources mswin.vim, which masks several useful Vim keybindings on the pretext of making life easier for Windows users (IMHO it doesn't; it just cripples Vim).

Personally I don't source that file (I wouldn't touch it with the proverbial ten-foot pole), and I use neither ":behave mswin" nor ":behave xterm" but something in-between, as follows:

        " selectmode=key,mouse and mousemodel=popup as with mswin
        " selection=inclusive as with xterm
        " keymodel=startsel - shift-left starts a selection but
        "  non-shift-left doesn't stop it: it extends it
        "  instead, just like shift-left-again
        set selection=inclusive selectmode=key,mouse
        set keymodel=startsel mousemodel=popup

I believe it gives me the best of both worlds, but YMMV.


I share the same .vimrc/_vimrc file among all the systems on which I
use Vim.  I've found MyDiff() useful even on Linux because it lets
me specify a few extra flags to diff and because it lets me hook the
entry-into-diff-mode event.

I've also stopped using that system _vimrc and use ~/_vimrc instead,
but I still check for changes to the system _vimrc.

$VIM/_vimrc is not a "system vimrc", it is one possible location on
DOS/Windows for the "user vimrc" on single-user systems where $HOME
has no sane value.

You're right.  I didn't think of it as a user vimrc since it's
shared by all users of the Windows system and I didn't look up the
proper name for it.

Regards,
Gary

Best regards,
Tony.
--
BEDEVERE: And that, my lord, is how we know the Earth to be banana-shaped.
"Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to