When I run vim --version
from a terminal, I see
VIM - Vi IMproved 8.1 (2018 May 18, compiled Aug 15 2018 18:27:33)
macOS version
Included patches: 1-280
Compiled by Homebrew
But when I run the same command within a Bash script, I see
VIM - Vi IMproved 8.0 (2016 Sep 12, compiled Jun 19 2019 19:08:44)
Included patches: 1-503, 505-680, 682-1283, 1365
Compiled by root@apple.com
The latter version is missing key features, like support for the system clipboard.
In both contexts, whoami
returns the same username, and which vim
return the same path.
How can I launch the Homebrew version from a script?
This kind of situation often results from having different PATH settings between interactive shell and Bash script, or having an alias or function defined.
A quick way to finding out is to run type -a vim