I teach classes that cover both Vim 7 and Vim 8. Is it possibly to install Vim 7 and Vim 8 together on CentOS? If so, how?

Everything I've have looked at so far covers updating Vim 7 to Vim 8. I need both environment for teaching purposes.

  • 1
    There are a few ways to do it. You could build Vim 7 from source and install it in parallel, or you could use a container image (for example, a CentOS 7 container) and run Vim 7 from there. But I see little point in doing anything with Vim 7 at this point, since the only distribution that still ships it (CentOS 7/RHEL 7) has already reached end of full maintenance...
    – filbranden
    May 4 '21 at 4:35
  • 2
    I would use the system vim (e.g. CentOS 7 comes with Vim 7 according to repology.org/project/vim/versions) and compile my own Vim version 8 below $HOME May 4 '21 at 6:45

@christian-brabant has the gist of it. At least one of them needs to be an installation outside of your package manager. Of course, if you are using an add-on package manager like conda, you can probably find them and stick them in different (virtual) environments.

To do it yourself.

Having multiple versions of software on a system only really requires, that those versions are installable and having a place to put them (it sounds pedantic but it is true). For Vim one way you can install both versions yourself is by following the instructions at https://www.vim.org/download.php#unix in different directories

for example

mkdir -p vim/8 && cd vim/8
git clone https://github.com/vim/vim.git
git checkout <myFavorateVim8tag>

and follow build instructions for 8 (Take a look at the README and .configure --help to get started) then if you'd like do the same for 7

mkdir -p vim/7 && cd vim/7
git clone https://github.com/vim/vim.git
git checkout <myFavorateVim7tag>

The main gotcha is making both accessible, depending on what else is going on you have lots of options, however in this case, since they are primarily interactive programs the cleanest option might be to alias them to different names.

  • 1
    Or add links to the programs like vim7 and vim8 in your PATH
    – D. Ben Knoble
    Oct 13 '21 at 1:06

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.