Friday, July 8, 2011

How to Make MacPorts vim default in Mac OS X Terminal

If you, like I did, ever wanted to use vim with more option, e.g. support for python, or ruby.. then you have to re-compile vim in order to use it in your Mac OS X. You can compile from source, or using Macports like me. You can also view several daily used command for macports in my blogpost here.

First, you can check what version of vim you have by typing "vim" in your Terminal apps. Then, using macports, you just execute this command:
$ sudo port -v install vim +python
After finished, you can find that newest version of vim (compare to built-in version of vim), is located in: /opt/local/share/vim/ directory

Or you can find it using find command:
$ sudo find / -name "vim"
After that, you need to put the path into $PATH, because if you're not doing that, Terminal apps in Mac OS X will execute the default built-in vim. Also, you need to put it in the beginning of your path:
PATH=/opt/local/share:/opt/local/bin:/opt/local/sbin:$PATH
That's it. Close your Terminal window/ tab, and start a new one. Type "vim" on your shell, and you'll see that you already have the new version of vim. Enjoy! :)

No comments:

Post a Comment

Hi, for all of those who already put comments on my blog post, thanks.. really appreciate it. And for those who have not, just put your comments here :)