I'm trying to redirect the output of a command to vim using the - argument, but it doesn't seem to work on OS X. For example, if I type

$ ls | vim - 

on the command line on one of my Linux machines, the output of ls is correctly piped to vim. But when I do the same thing on any of my OS X machines, I get

$ ls | vim -
Vim: Reading from stdin...

And it just hangs there until I hit CTRL-D.

Any idea why this would be happening and how to actually redirect the output of a command to vim?

For reference, I'm using OS X 10.6.4 (and 10.6.5) with vim 7.2 (and 7.3) with bash as my shell.


I would expect a hand like this if their were problems with permissions. This page expands on Vi on OS X more than I ever could. Rather than just cut and paste their answers, I thought I'd point you to it to see if it helps.


It mentions that forking was non-standard and that to fork, one should provide the whole path to binary. Making an alias to the whole path, like vim='TERM=xterm-color vim' would do the trick.

  • Reading through that whole page, I got to a section where it mentioned that forking was non-standard and that to fork, one should provide the whole path to binary. Doing that, piping a command's output to vim worked fine. So I figured I'd just make an alias for vim that would provide the whole path, and that's when I noticed: sometime, years ago, I had already created an alias for vim: alias vim='export TERM=xterm-color; vim'. I fixed this to alias vim='TERM=xterm-color vim' and now it works just as it should. Thanks for indirectly leading me to the solution :-). – RTBarnard Nov 20 '10 at 6:13
  • Any time I can cluelessly get someone to the right place, well, luck is better than skill... :) – Everett Nov 20 '10 at 6:23
  • The link seems broken. Considering this is the selected answer, and the answer is pretty useless without the link, It really feels like a good idea to include the relevant bits of information in the answer. I'm sorely tempted to include the information from the comments into an answer but that's a pretty massive edit – Journeyman Geek Mar 13 '17 at 0:27

Use the -f option for macvim. And the -R option to quit without being asked to save.

ls | mvim -Rf -

Another example... svn diff | mvim -Rf -

-f option

-f  or  --nofork    Foreground: Don't fork when starting GUI

-R option

-R          Readonly mode (like "view")

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.