Search code examples
vimmacvim

How can I get vim to point to macvim? Where can I find macvim?


I would like vim to point to macvim :)

Probably through an alias.

vim is here: whereis vim /usr/bin/vim

macvim I can't find, e.g. whereis macvim returns nothing


Solution

  • My answer is kind of the opposite of michaelmichael's and I've made it quite a few times:

    MacVim comes with a CLI executable that you can use in place of Mac OS X's default Vim if you add a single alias to your ~/.bashrc/~/.profile. No need to compile anything, no need to put MacVim in a special place, no need to overwrite default programs with symlinks

    This way, you can stay in CLI-land and enjoy the power of a powerful/recent/fast Vim.

    EDIT

    MacVim is a native Mac OS X GUI version of Vim. It doesn't come preinstalled with your OS so you have to download it from the Internet or install it through homebrew (see michaelmichael's answer). Once it's installed, MacVim is where you have put it, plain and simple.

    Because it's a full fledged GUI app, MacVim can't really be used as a drop-in replacement for the default Vim in the terminal.

    `$ MacVim file.txt` will not work. `$ open -a macvim file.txt` will not work either.
    

    You basically have two options: use the mvim CLI wrapper to open MacVim from the terminal or use an alias to MacVim's bundled CLI executable.

    1. The mvim wrapper

      I think michaelmichael's answer could be a expanded a bit but the most important is said.

      EDIT: well scratch that.

    2. The bundled CLI executable

      Just add this line (customized to reflect your system) to your ~/.bashrc or ~/.profile or whatever file is run by your shell at startup:

      alias vim='/path/to/MacVim.app/Contents/MacOS/Vim'
      

      Open a new terminal window, $ vim file.txt should launch vim in your terminal window, just like the default /usr/bin/vim but with a lot more bells and whistles.