Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use Vim 7.4 on Mac OS after install it by brew?

Tags:

vim

macos

I have installed vim by brew on the newest Mac OS:

brew install vim

And when I type brew info vim, it shows:

vim: stable 7.4.891, HEAD
Vi "workalike" with many additional features
http://www.vim.org/
Conflicts with: ex-vi
/usr/local/Cellar/vim/7.4.891 (1612 files, 28M) *
  Built from source
From: https://github.com/Homebrew/homebrew/blob/master/Library/Formula/vim.rb
...

But if type vim, it shows me a 7.3 version's vim:

VIM - Vi IMproved
  version 7.3
...

How can I use the 7.4 version?

like image 252
scho Avatar asked Oct 14 '15 02:10

scho


People also ask

Is vim installed by default on Mac?

Vim is a powerful code editor. So powerful that both Linux and Mac have it installed by default.

Where is vim installed on Mac?

The path used by macOS's default vim install is /usr/share/vim/vimrc .

Is homebrew automatically installed on Mac?

By default, it installs Homebrew so you can use the brew command without typing the sudo command and providing your password. UPDATE: The below command is no longer necessary. Homebrew Cask is now automatically installed as part of Homebrew itself.


2 Answers

Just need exit the terminal and re-enter, brew will install vim link at /usr/local/bin/vim, but it will be enable only when terminal started.

like image 108
Eric Guo Avatar answered Sep 18 '22 18:09

Eric Guo


You need to set PATH so that /usr/local/bin appears before /usr/bin

vim .zshrc(if you use zsh) or .bash_profile and paste

export PATH=/usr/local/bin:$PATH

hope this help you!

like image 23
Luan D Avatar answered Sep 20 '22 18:09

Luan D