[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Symbolic links in /etc/alternatives not working as intended



users@linuxforums.org wrote:
> I'm trying to update my /usr/bin/vi to use gvim instead of vim.

Hmm...  I personally think a symlink or wrapper in /usr/local/bin
would be easiest and most appropriate.  It is a local configuration
for you but not really part of the system.  YMMV.

> david:/home/david# update-alternatives --display vi 
> vi - status is auto.
> link currently points to /usr/bin/vim
> /usr/bin/nvi - priority 30
> slave vi.1.gz: /usr/share/man/man1/nvi.1.gz
> /usr/bin/vim - priority 120
> slave vi.1.gz: /usr/share/man/man1/vim.1.gz
> Current `best' version is /usr/bin/vim.

Right, gvim is a symlink created by the 'vim' package which points to
/usr/bin/vim.  The 'vim-gtk' package diverts /usr/bin/vim to vim.org
so with vim-gtk installed (which I think is typical for gvim users)
gvim gets you the graphical vim with gtk widgets.

> update-alternatives --install /usr/bin/vi vi /usr/bin/gvim 130 --slave
> /usr/bin/vi vi.1.gz /usr/share/man/man1/vi.1.gz
> 
> Entering this command will return me the help file on
> update-alternatives instead. I suspect the syntax for my --slave
> arguement is wrong, most likely the <link>. What link is
> pointing to vi.1.gz , with the <name> of vi.1.gz and pointing
> to <path> /usr/share/man/man1/vim.1.gz ?
> 
> I've read the man pages, but it doesn't elaborate further on the usage
> of the --slave arguement.

The easiest thing is to look at the vim postinst script and see what
it does to set this up.

  pager /var/lib/dpkg/info/vim.postinst

There is a for loop that translates to this example:

    update-alternatives --install /usr/bin/vi vi /usr/bin/vim 120 \
      --slave /usr/share/man/man1/vi.1.gz vi.1.gz /usr/share/man/man1/vim.1.gz

Which means I think you want to say this to create your own
alternative pointing to gvim.  (Untested!)

    update-alternatives --install /usr/bin/vi vi /usr/bin/gvim 150 \
      --slave /usr/share/man/man1/vi.1.gz vi.1.gz /usr/share/man/man1/gvim.1.gz

Does gvim behave like vi on a text terminal?  Hope so because that
what I would expect of an alternative for vi.  Personally I would
simply call it vim or gvim instead of getting used to calling it vi
since it is so much different from vi it really is hardly an
alternative for it.

Bob

Attachment: pgpJTW53zz50E.pgp
Description: PGP signature


Reply to: