Search code examples
macosvimhomebrew

Why should I install vim via brew when I already have vim preinstalled on my mac?


I've read multiple topics about using vim on mac and almost all of it suggests me to use the install vim via homebrew:

brew install vim

However, vim is already preinstalled on my mac as I can easily access through terminal. So why does everyone install vim through brew when they already have it preinstalled?

And should I install vim via brew or just use the preinstalled one?

Any answers would help, thank you so much.


Solution

  • The Unix-like systems that come with Vim by default do so only because they "need" a ex command and a vi command for POSIX compatibility and Vim, a well maintained, modern, and pretty faithful vi clone, happens to have a relative permissive licence that makes it easy to include.

    But size matters. Since it is possible to build Vim with or without a number of features, the default Vim, if any, is always a "tiny", "small", or "normal" version, built with varying subsets of features.

    Therefore, the problem is the same on every system that comes with Vim by default: if the user needs features that are not included in the default build, they must get another one and $ brew install vim is one way to do it on macOS.

    Here are a few potentially useful things that are missing from the default Vim on macOS:

    • Python support,
    • :help 'langmap' and :help 'keymap',
    • clipboard support,
    • etc.

    with Python and clipboard being the most common reasons, across systems.

    Of course, there is no point installing an alternative Vim if you are satisfied with /usr/bin/vim.