msch | June 21, 2011 |
ArticlesWant to use Command-Control-Left/Right to move forward/backwards between open files in MacVim, just like you are used to from Xcode?
Put this in your ~/.gvimrc and restart MacVim:
if has("gui_macvim")
" Remove default keybindings for Command-Control-Left/Right
macmenu Tools.Next\ Error key=<nop>
macmenu Tools.Previous\ Error key=<nop>
" switch to previous buffer
map <C-D-Left> :bp<CR>
" switch to next buffer
map <C-D-Right> :bN<CR>
endif
UPDATE: Snippet didn’t work, I forgot to HTML escape it. Sorry for that, it’s all fixed now.
msch | June 21, 2011 |
Articles$ some script | grep something
bash: grep: command not found
If you are using a Mac with a German (or French, see below) keyboard layout and your typing is as sloppy as mine, chances are you are familiar with this error. You probably also know that deleting the space before grep fixes it. Why is this?
Option-7 corresponds to the | character. Option-Space corresponds to the non breaking space which looks just like the regular space but is – as far as the shell is concerned – totally different. And obviously there’s no grep command on your system. And if you still hold down Option while pressing space… Guess what will happen… Now how do we fix it?
Check out the documentation on Mac OS X Key Bindings or simply make your ~/Library/KeyBindings/DefaultKeyBinding.dict file look like this (if it doesn’t exist create it, if there are already bindings in it just add the one from below)
{
"~ " = ("insertText:", " ");
}
What does this do? Every time you press Option-Space instead of inserting a non breaking space OS X now inserts a regular space. Problem fixed.
Update: Thanks to Julien Palmas for pointing out that this also applies to French keyboard layouts:
For French keyboards, the non breaking space is option+shift+space, and the “|” character is option+shift+L. So fast typing often leads to the same error
I migrated this post from my previous blog.
msch | June 21, 2011 |
ArticlesAfter spending an hour on it I figured out how to make an Xcode 4 template where one target has a target dependency on another target (= one target depends on another target).
It’s quite simple, all you have to do is add an Array “Dependencies” to the Target, where you refer another Target by number.

Some background:
I’m currently writing an awesome app in MacRuby. MacRuby projects have both a normal target and a Deployment target, which compiles and embeds the MacRuby framework in your .app so that it can be distributed to others that don’t have MacRuby installed.
Unfortunately currently MacRuby’s Xcode templates don’t make the Deployment target depend on the normal target, so if you, for example, clean and then run Deployment it won’t build.
Took me a few hours but I submitted a pull request to the awesome MacRuby folks.
msch | June 7, 2011 |
ArticlesYeah, I’m gonna blog. About indie development stuff.