vimrc: identify "small" version vs "huge" version

36 views
Skip to first unread message

ping song

unread,
Oct 2, 2020, 11:34:49 AM10/2/20
to vim-use Mailingliste
experts:
I found in centos 7 there is /usr/bin/vi and /usr/bin/vim, with same version, patches.
but vi is the "small" version and "vim" is the huge one. 
obviously both will use same .vimrc, and when vi is used a lot of errors pop up because of the much less features compiled.
how do I differ these two in  my .vimrc file?

thanks.
Message has been deleted

Richard Mitchell

unread,
Oct 2, 2020, 12:29:30 PM10/2/20
to vim_use
Does

echo v:progname

show a different result?
 

Gary Johnson

unread,
Oct 2, 2020, 1:04:58 PM10/2/20
to vim-use Mailingliste
Unfortunately, the small version does not include the +eval feature,
which means that you can't use :if/:else/:endif along with has() in
the usual manner to skip features in your vimrc that your vim
doesn't support. However, without the +eval feature, vim will
simply skip over any :if/:endif construct it finds. Therefore, you
can still use :if/:endif to avoid commands and options that the
small version doesn't understand. (You can't use :else here.
Without the +eval feature, vim will also skip over :else blocks.)

For example:

if eval
set some_option_not_in_small_version
endif

See

:help :version
:help :if

Regards,
Gary

John Little

unread,
Oct 2, 2020, 9:56:18 PM10/2/20
to vim_use
On Saturday, October 3, 2020 at 4:34:49 AM UTC+13, ping wrote:

I found in centos 7 there is /usr/bin/vi and /usr/bin/vim, with same version, patches.

I was using a new centos 7 instance this week, and the version of vim was old, 7.4, and very minimal.  The centos 7 repositories do not have a more recent version.

I followed the instructions at https://phoenixnap.com/kb/how-to-install-vim-centos-7, except I did not remove anything, and did not include any of the interpreter stuff.  It was quick and painless, now have a "huge" vim 8.2.

Regards, John Little

Tony Mechelynck

unread,
Oct 3, 2020, 2:37:02 PM10/3/20
to vim_use
The most important diference is that the "small" and "tiny" versions
are compiled without the +eval feature. A possible solution takes
advantage of the fact that in -eval builds, the :if .. :endif complex
statement becomes a nestable comment: so if you add "if 1" at the
start of your vimrc and "endif" at the end, everything in between will
be ignored by the "small" version.

If that seems too much for you, you could write at the top a few
unconditional statements compatible with the "small" version (see
:help +feature-list and use only features preceded by S or T) then
after that write "if 1" alone on a line, any statements to be
interpreted only by builds compiled with +eval, and finally "endif",
again alone on its line.

Best regards,
Tony.
Reply all
Reply to author
Forward
0 new messages