8

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!

littlejim84
  • 9,071
  • 15
  • 54
  • 77

3 Answers3

53

:!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.

muhmuhten
  • 3,313
  • 1
  • 20
  • 26
5

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
ZMorek
  • 679
  • 1
  • 8
  • 24
too much php
  • 88,666
  • 34
  • 128
  • 138
1

This is the homebrew formula for vim. Try these settings for "configure" or just install homebrew and install vim from there.

system "./configure", "--prefix=#{prefix}",
                      "--mandir=#{man}",
                      "--enable-gui=no",
                      "--without-x",
                      "--disable-nls",
                      "--enable-multibyte",
                      "--with-tlib=ncurses",
                      "--enable-pythoninterp",
                      "--enable-rubyinterp",
                      "--with-features=huge"
system "make"
system "make install"
abdollar
  • 3,365
  • 1
  • 18
  • 23
  • what's with all the `system`s? why not just use a shell script? – muhmuhten Sep 24 '10 at 00:39
  • homebrew is a package manager for osx. The system calls above are part of the formula which is a ruby script. See http://mxcl.github.com/homebrew/ – abdollar Sep 25 '10 at 01:15
  • I can't actually find the normal vim formula in the homebrew repository. All I find is macvim. Has it been removed? – Marlun Nov 28 '10 at 22:28
  • looks like its gone. Do the alias thing I guess /Applications/MacVim.app/Contents/MacOS/Vim – abdollar Nov 29 '10 at 22:14