How do I update the version of vim running in the console on Mac OSX?

I'd like to run the latest version of vim from the console (and not as a separate app).

How do I update it?


Solution 1:

There are many ways to do that:

  • install Vim from the sources found at www.vim.org
  • install Vim via MacPorts
  • use the CLI vim that comes with the latest MacVim build

If you go with the two first solutions, you need to do two things afterwards:

  1. make sure the folder containing your new shiny Vim is in your $PATH

  2. add an alias to your custom vim in ~/.profile and set the $EDITOR environment variable if needed

    alias vim='/path/to/custom/vim/folder/vim'
    EDITOR=/path/to/custom/vim/folder/vim
    

    If you use Git or Subversion or another tool that uses Vim as an editor you might need do some more configuration, too.

All my past attempts to build Vim from sources or via MacPorts while matching MacVim's features have resulted in slow and oversized memory hogs (think 10 seconds startup).

The best solution for me is to just use MacVim's CLI binary which is located in MacVim's bundle:

EDITOR=/Users/romainl/Applications/MacVim.app/Contents/MacOS/Vim
alias vim='/Users/romainl/Applications/MacVim.app/Contents/MacOS/Vim'

Which gives you a very modern, feature-packed and speedy Vim.