So, last night I upgraded my dev machine to Snow Leopard and what kind of a dev machine would it be without Vim?
Fortunately, for some at least, OS X still ships with Vim precompiled, unfortunately for me tough it still don’t come with ruby support enabled.

Since MacVim, which I usually use, isn’t yet compatible with Snow Leopard I decided to try and compile the regular vim as Mathias explained in a previous blog post about compiling for leopard, well that attempt crashed and burned. I did however get it to compile correctly after a minor tweak to his instructions:

On line 7 in src/auto/config.mk I changed the following line:
LDFLAGS = -L. -arch i386 -arch x86_64

To look like:
LDFLAGS = -L. -arch x86_64

While it did compile successfully, launching Vim just resulted in it exiting immediately with the message: abort trap.

Back at square one I started browsing the vim_mac mailing list and here’s how I finally got it working:

Start off by cloning the macvim repository:
~ $ git clone git://repo.or.cz/MacVim.git

Then change into the MacVim/src directory and configure and run make:
~ $ cd MacVim/src
MacVim/src $ ./configure --enable-gui-macvim --enable-rubyinterp
MacVim/src $ make

Now change into the MacVim directory:
MacVim/src $ cd MacVim

Normally this is where you would run xcodebuild, however that resulted in the following:
** BUILD FAILED **
The following build commands failed:
MacVim:
PhaseScriptExecution "Make Document Icons" /Users/pmh/Downloads/MacVim/src/MacVim/build/MacVim.build/Release/MacVim.build/Script-1D1C31F00EFFBFD6003FE9A5.sh
(1 failure)

The way to get around this is a bit cumbersome, but works.

Start by deleting line 6 in the Makefile that lives under the icons directory:
MacVim/src/MacVim $ cd icons
MacVim/src/MacVim/icons $ vim Makefile
# delete line 6 and save

Then change line 22 in make_icons.py, in the same directory, from:
dont_create = False
to:
dont_create = True

Change back to the MacVim directory and run xcodebuild:
MacVim/src/MacVim/icons $ cd ..
MacVim/src/MacVim $ xcodebuild

You should now see something like the following:
PyObjC not found, only using a stock icon for document icons.
** BUILD SUCCEEDED **

Now move the MacVim.app to the /Applications folder:
MacVim/src/MacVim $ mv build/Release/MacVim.app /Applications/

In order to invoke vim from the command line you need to add the following alias to your ~/.profile or what have you:
alias vim=/Applications/MacVim.app/Contents/MacOS/Vim

Note however that this only lets you use the command line version of MacVim, there seems to still be some issues with the graphical one.

Update:
As Björn pointed out in the comments, the graphical version of MacVim does work under Snow Leopard, also be sure to checkout his precompiled binary

Posted in Mouseless, Operatingsystem, Utilities at September 1st, 2009. 2 Comments
Tagged with , , . Written by: Patrik Hedman

If you, like me, are tired of vim’s pesky backup and swap files littering your project directory then you too should create a .vimtmp directory in your home folder and add this little snippet to your .vimrc

" Store vim backups and *.swp files in ~/.vimtmp with a unique name
set backupdir=~/.vimtmp//
set directory=~/.vimtmp//

Now all your backup and swap files will be stored in ~/.vimtmp/ and prefixed with a formatted file path, eg, %some%where%on%my%computer%some_file.ext.swp

Posted in Utilities at August 17th, 2009. 2 Comments
Tagged with , , . Written by: Patrik Hedman

Configure and compiling VIM under OS X did not work out-of-the box for me. I did not want to use MacPorts VIM as it’s dependent on ruby (if you like me want that) and I did not find a way of compiling MacPorts VIM against my local ruby.

This post is about how to get VIM compiling on OS X/intel without the use of MacPorts.

Read More…

Posted in Programming at January 11th, 2009. 4 Comments
Tagged with , , , . Written by: Mathias Stjernström

pastbedti.me is using WP-Gravatar