Saturday, October 8, 2022

Re: Where should $VIM point to?

On Fri, Oct 7, 2022 at 11:42 AM Enan Ajmain <3nan.ajmain@gmail.com> wrote:
>
> On Fri, 7 Oct 2022 11:13:27 +0200
> Tony Mechelynck <antoine.mechelynck@gmail.com> wrote:
>
> > There are rare cases (which I won't describe here — if they applied to
> > you you would know it, and what to do) where it is worth setting $VIM
> > to some nondefault value.
>
> Thanks for the information. The thing is I knew all the things you
> explained (not a terribly new user here; been using for five years).
> Except the use case of $VIM. Which you "won't describe here." Any link
> where I can read up on it?
>
>
> --
> Enan

Well, the Vim executables I compile myself come with $VIM defaulted to
/usr/local/share/vim and $VIMRUNTIME set to
/usr/local/share/vim/vim90/. Those from my Linux distro have $VIM set
to /usr/share/vim and $VIMRUNTIME set to /usr/share/vim/vim90. The
"system vimrc" is at, respectively, $VIM/vimrc and /etc/vimrc but
neither of them exist. My vimrc sets $VIM to /usr/share/vim so that
they both will find my user-written scripts (at $VIM/vimfiles and
below) at a common location. I don't touch $VIMRUNTIME so each of them
uses its own "distribution" scripts. This way, in the rare case that I
have to use the distro's Vim rather than my own, it will work
identically apart from a difference in patchlevels and in featureset.

The following lines do that, at the very top of my vimrc:

let $VIM = '/usr/share/vim'
set runtimepath=~/.vim,$VIM/vimfiles,$VIMRUNTIME,$VIM/vimfiles/after,~/.vim/after

let $VIMSRC = expand('~/.build/vim/vim-hg/src', ':p')

The ":set runtimepath" statement is there to make sure that the new
value of $VIM is correctly taken up. $VIMRC is an environment variable
which I set within Vim to get easily at my Vim source.

Best regards,
Tony.

--
--
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 vim_use+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/CAJkCKXuv9-oB55YcbYPVtjDsMWZ-VsXi6C0Z8iWswch57Neeuw%40mail.gmail.com.

No comments: