4

When I type :version inside Vim and I got a list of features as below, and I realized that there are some features/packages not installed by default (-python3 for example). How do I include/install more feature to built-in (macOS version) Vim? Would my changes be overwritten by updates from Apple?

what appears when I type :version in mac Terminal

1
  • Hello, normally you need to recompile vim to do so (see :help :version). PS: I think it's better for you to use :help [the thing you're looking for], :helpgrep [the thing you're looking for] or google it. You will be more independent and it will save you the time asking the question Jan 3, 2021 at 16:08

1 Answer 1

2

Install Homebrew and, once you have it installed, get Vim from Homebrew:

$ brew install vim

Note that Homebrew will install Vim (and all its packages) under /usr/local, which will not interfere or remove any system packages.

You should typically configure your system to ensure /usr/local/bin appears in $PATH ahead of the system directories such as /usr/bin, so that the Homebrew versions are the ones that get used.

The default Vim you get from Homebrew (see formula for Vim here) comes with support for latest Python, also Ruby, Lua and Perl (see dependencies of the formula.) As a consequence, Homebrew will also install versions of the interpreters and runtime for those languages (so you'll end up with a second copy of them under /usr/local as well.)

You can also often control some options of how Homebrew packages get installed by passing --with or --without options. For example:

$ brew install vim --without-perl --with-override-system-vi

You might want to read Homebrew docs if you plan to use it and want to understand how it works and all it can do.

5
  • Inside system Vim I typed :echo $VIM I got /usr/share/vim while in Terminal which vim I got /usr/bin/vim, so what's the difference between these two Vim? btw I have two built-in Vim? Jan 3, 2021 at 16:16
  • 1
    Actually I did install Homebrew for other reason, but thanks for your answer! Jan 3, 2021 at 16:17
  • 2
    The $VIM variable is not the path to the vim binary, but rather a path to where Vim can find its auxiliary files (such as the Vim runtimes and possibly a system-wide vimrc file.) See :help $VIM inside Vim to read more about that variable. Both directory /usr/share/vim and file /usr/bin/vim belong to the system install of Vim. In Homebrew Vim both would be in /usr/local.
    – filbranden
    Jan 3, 2021 at 16:22
  • Do we really not have a dupe for this? Shocked
    – D. Ben Knoble
    Jan 3, 2021 at 20:24
  • @Ben I often go hunting for duplicates just to find them in S.O. instead... 😒
    – filbranden
    Jan 3, 2021 at 20:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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