1

My system is RHEL 7.5 and the output of vim --version as below:

me@localhost:~/tmp$ vim --version
VIM - Vi IMproved 7.4 (2013 Aug 10, compiled Aug  9 2019 03:17:15)

I want to use vim 8 so I downloaded the source code of vim 8, compiled it and installed it.

Now, when I type which vim, the output is /usr/local/bin/vim, which is exactly what I just intalled.

/usr/local/bin/vim --version showed me

VIM - Vi IMproved 8.2 (2019 Dec 12, compiled Apr 17 2020 12:27:50)
Included patches: 1-587
Compiled by [email protected]

Everything looks fine.

However, if I execute vim --version, it's still vim 7, instead of vim 8.

Now I'm totally confused.

As my understanding, which vim tells me which command it will use, which vim shows me /usr/local/bin/vim, so why vim --version used another vim (/usr/bin/vim), instead of /usr/local/bin/vim?

Yves
  • 3,161
  • 7
  • 26
  • 54
  • 1
    The path may have been hashed by your shell - see for example [Why isn't the first executable in my $PATH being used?](https://unix.stackexchange.com/questions/91173/why-isnt-the-first-executable-in-my-path-being-used?) – steeldriver Apr 20 '20 at 02:09
  • 1
    @steeldriver Ohh, thanks. `hash -r` helps. – Yves Apr 20 '20 at 02:11

0 Answers0