scho
scho

Reputation: 3585

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

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?

Upvotes: 14

Views: 11500

Answers (3)

Luan D
Luan D

Reputation: 1350

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!

Upvotes: 6

Eric Guo
Eric Guo

Reputation: 1775

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.

Upvotes: 17

scho
scho

Reputation: 3585

My solution is put these into my ~/.zshrc file:

alias vi='/Applications/MacVim.app/Contents/MacOS/Vim'
alias vim='/Applications/MacVim.app/Contents/MacOS/Vim'
alias gvi='/Applications/MacVim.app/Contents/MacOS/Vim -g'

I installed MacVim.

So it works well.

Reference

https://www.reddit.com/r/vim/comments/2ukp5j/starting_homebrew_version_of_vim/

Upvotes: 3

Related Questions