By default, the version of vim on centos7 is 7.4. I want to update it to vim 8. There are some questions with 'https://copr.fedorainfracloud.org/coprs/mcepl/vim8/repo/epel-7/mcepl-vim8-epel-7.repo -o /etc/yum.repos.d/mcepl-vim8-epel-7.repo'. So, how can I to update it?


That repo is no longer available. Instead, use this (source: https://gist.github.com/yevrah/21cdccc1dc65efd2a4712781815159fb)

rpm -Uvh http://mirror.ghettoforge.org/distributions/gf/gf-release-latest.gf.el7.noarch.rpm
rpm --import http://mirror.ghettoforge.org/distributions/gf/RPM-GPG-KEY-gf.el7

yum -y remove vim-minimal vim-common vim-enhanced
yum -y --enablerepo=gf-plus install vim-enhanced sudo
  • When I ran this, removal of vim-minimal removed sudo. When I tried this on my new machine without removing vim-minimal, vim-common conflicted with the old vim-minimal. How is this supposed to be done?
    – firebush
    Oct 28 '19 at 17:12
  • Ah, I removed vim-minimal as a separate step without yum but rather used rpm with --nodeps. That removed vim-minimal without removing sudo: rpm -e --nodeps vim-minimal. In any case, thanks for the post.
    – firebush
    Oct 28 '19 at 17:16

otter.pro's answer is helpful but be aware that it will remove sudo with vim-minimal in the yum remove step because sudo depends upon vim-minimal. If running as root, no problem. But if you're running with sudo, you can find yourself stuck without root access anymore after sudo gets removed.

I followed his steps, but used rpm to do a targeted removal of just vim-minimal so that sudo would not be removed in the process (thanks to a tip from https://superuser.com/a/1307216):

sudo rpm -Uvh http://mirror.ghettoforge.org/distributions/gf/gf-release-latest.gf.el7.noarch.rpm 
sudo rpm --import http://mirror.ghettoforge.org/distributions/gf/RPM-GPG-KEY-gf.el7

sudo yum -y remove vim-common vim-enhanced vim-filesystem
# Don't 'yum remove' vim-minimal because that will remove sudo:
sudo rpm -e --nodeps vim-minimal
sudo yum -y --enablerepo=gf-plus install vim-enhanced
  • Welcome to Vi and Vim! Glad you found a way to solve this problem! I noted that in the other answer, otter.pro reinstalled sudo—but this is definitely a different way to do it!
    – D. Ben Knoble
    Oct 28 '19 at 22:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.