This is the mail archive of the cygwin-apps mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [RFC] vim-minimal in Base?


2013/5/20 Yaakov (Cygwin/X):
> Basically, if you want features, keep using vim.  Otherwise, ex/vi
> (vim-minimal) provides the basic POSIX functionality.  The big change is
> that vi != vim anymore.
>
>> Apart from that, I guess calling vi (and that's what *many* users are
>> used to) will now result in the same error Frank reported.
>
> The workaround will be to use ~/.virc with vi.

But why vi != vim? alternatives fixes this on Debian/Ubuntu. Why not
use it on Cygwin?

vim-7.3.762 used a update-alternative in its postinstall script when
there was no conflict (at least not on my setup with X). But
vim-7.3.943 doesn't have it anymore. alternatives is in base, it is
made to solve these kinds of conflicts. Why did you stop using it now
that the conflict really started to happen?

Letting the postinstall scripts return with the proper priority fixes
the problem. It works perfectly when I run it manually. The command
"vi" is always available and automatically uses the best version of
vim.

My steps:

renamed vi.exe to vim-minimal.exe
renamed vim.exe to vim-nox.exe

Run these commands: (add as postinstall scripts):

/usr/sbin/update-alternatives \
    --install /usr/bin/vim vim /usr/bin/vim-minimal.exe 10 \
    --slave   /usr/bin/vi vi /usr/bin/vim-minimal.exe \
    --slave   /usr/bin/view view /usr/bin/vim-minimal.exe \
    --slave   /usr/bin/vimdiff vimdiff /usr/bin/vim-minimal.exe \
    --slave   /usr/bin/rvim rvim /usr/bin/vim-minimal.exe \
    --slave   /usr/bin/rview rview /usr/bin/vim-minimal.exe

/usr/sbin/update-alternatives \
    --install /usr/bin/vim vim /usr/bin/vim-nox.exe 30 \
    --slave   /usr/bin/vi vi /usr/bin/vim-nox.exe \
    --slave   /usr/bin/view view /usr/bin/vim-nox.exe \
    --slave   /usr/bin/vimdiff vimdiff /usr/bin/vim-nox.exe \
    --slave   /usr/bin/rvim rvim /usr/bin/vim-nox.exe \
    --slave   /usr/bin/rview rview /usr/bin/vim-nox.exe

Now vi links to the best vim available.

$ /usr/sbin/update-alternatives --display vim
vim - status is auto.
 link currently points to /usr/bin/vim-nox.exe
/usr/bin/vim-minimal.exe - priority 10
 slave rview: /usr/bin/vim-minimal.exe
 slave rvim: /usr/bin/vim-minimal.exe
 slave vi: /usr/bin/vim-minimal.exe
 slave view: /usr/bin/vim-minimal.exe
 slave vimdiff: /usr/bin/vim-minimal.exe
/usr/bin/vim-nox.exe - priority 30
 slave rview: /usr/bin/vim-nox.exe
 slave rvim: /usr/bin/vim-nox.exe
 slave vi: /usr/bin/vim-nox.exe
 slave view: /usr/bin/vim-nox.exe
 slave vimdiff: /usr/bin/vim-nox.exe
Current `best' version is /usr/bin/vim-nox.exe.

Add the corresponding preremove scripts:

/usr/sbin/update-alternatives --remove vim /usr/bin/vim-minimal.exe

/usr/sbin/update-alternatives --remove vim /usr/bin/vim-nox.exe

Are there any reasons not to use this?

Regards,
Frank


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]