Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Compiled vim from source on Mac OSX and getting 'shell returned 127' error?

On my Mac OSX 10.6 machine, I started to use MacVIM for vim. Then I noticed my terminal version was different to the MacVIM version (MacVIM was 7.3 and my terminal version 7.2)... I thought they used the same vim?

I need 7.3 for some of the features. So I set about wanting to update the terminal version. I basically cloned it using Mercurial (the perferred way according to the official site) and then did the usual to compile it. This did work and I now have 7.3 in my terminal. But, on some commands when exiting, I can this error:

/bin/bash: q: command not found

shell returned 127

Press ENTER or type command to continue

...I've tried my hardest to try and fix this problem, but trying to reinstall MacVIM, deleting the vim in my /usr/local/bin and compiling again and I just can't get rid of this annoying error.

Can anyone possibly help me? Am I doing this all wrong? ...most of the time I will be using MacVIM, but it'd be nice for me to have it in the Terminal - exactly how I'd have it on my Ubuntu servers.

Any help would be fantastic!

like image 365
littlejim84 Avatar asked Sep 23 '10 23:09

littlejim84


2 Answers

:!q is not :q!. This is probably not a bug.

The error message you're seeing is is most likely the result of accidentally typing :!q instead of :q!, which would be user error, not a bug. :!q shells out to run q, and your shell (bash) is not finding such a command and bails with 127. (For comparison, you might try :!true, :!false, :!vim %, to get a feel of this.)

There isn't really a “fix” for this, and ! is really useful for other purposes; maybe with more practice you'll make the typo less often. You could also try using ZQ instead of :q!; this has other disadvantages (a typo ZZ will instead save the file if it's edited, and ZQ specifically is a vim extension), but at least you see this error again.

The upshot here is basically check to make sure you typed in your commands right, I guess.

like image 158
muhmuhten Avatar answered Oct 29 '22 14:10

muhmuhten


I'm not sure on the exact path, but somewhere a few folders deep into the Applications/MacVim.app folder is the vim executable that will also run in a terminal (Use the -g option to launch it in GUI mode).

You should be able to throw this in your .bashrc:

alias vim=/Applications/MacVim.app/Contents/MacOS/vim
like image 28
too much php Avatar answered Oct 29 '22 15:10

too much php