Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I use mvim to edit my crontab on Mac OS X (10.6.6)

Tags:

vim

macos

macvim

mvim is installed in /usr/local/bin/ but can not be used as either EDITOR or VISUAL:

$ mvim -f # works as expected

$ EDITOR="/usr/local/bin/mvim -f" crontab -e
crontab: /usr/local/bin/mvim -f: No such file or directory
crontab: "/usr/local/bin/mvim -f" exited with status 1

I tried single quotes and using VISUAL instead of EDITOR. Same result. I also tried googling, but apparently the -f flag works just fine for everybody else.

I use Mac OS 10.6.6 and zsh, but the problem is the same in bash.

like image 418
Lorenz Avatar asked Feb 11 '11 10:02

Lorenz


1 Answers

The problem is crontab expects to be able to run a program called "/usr/local/bin/mvim -f" if you supply that in the EDITOR environment variable.

To get around that, you could write a short shell script. For example, call this one mvimf:

#!/bin/bash
/usr/local/bin/mvim -f "$@"

Then you can run: EDITOR=/usr/local/bin/mvimf crontab -e

like image 82
Morton Fox Avatar answered Oct 26 '22 17:10

Morton Fox