Qiang Blog

Just another zhangjingqiang's blog.

How to use vim 7.4 after install it by brew on MacOS

Problem

After install vim 7.4 by brew:

brew install vim

Type brew info vim, will show:

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, will show:

VIM - Vi IMproved
  version 7.3
...

The reason is the PATH.

Solution

Install macvim:

brew install macvim

Add these settings to ~/.bashrc or ~/.zshrc:

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'

Then type vim will use 7.4 version.

Reference

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

mac vim