bash 在 Mac OSX 上从源代码编译 vim 并收到“shell 返回 127”错误?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/3783273/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Compiled vim from source on Mac OSX and getting 'shell returned 127' error?
提问by littlejim84
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?
在我的 Mac OSX 10.6 机器上,我开始使用 MacVIM for vim。然后我注意到我的终端版本与 MacVIM 版本不同(MacVIM 是 7.3,我的终端版本是 7.2)...我以为他们使用相同的 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:
对于某些功能,我需要 7.3。所以我开始想要更新终端版本。我基本上是使用 Mercurial 克隆它(根据官方网站的首选方式),然后照常编译它。这确实有效,我现在在我的终端中有 7.3。但是,在退出时的某些命令上,我可能会出现此错误:
/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.
...我已尽最大努力尝试解决此问题,但尝试重新安装 MacVIM,删除 /usr/local/bin 中的 vim 并再次编译,但我无法摆脱这个烦人的错误。
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.
任何人都可以帮助我吗?我做这一切都错了吗?...大部分时间我将使用 MacVIM,但在终端中使用它对我来说很好 - 正是我在我的 Ubuntu 服务器上使用它的方式。
Any help would be fantastic!
任何帮助都会很棒!
采纳答案by too much php
I'm not sure on the exact path, but somewhere a few folders deep into the Applications/MacVim.appfolder is the vimexecutable that will also run in a terminal (Use the -goption to launch it in GUI mode).
我不确定确切的路径,但文件夹深处的几个文件Applications/MacVim.app夹是vim也将在终端中运行的可执行文件(使用该-g选项在 GUI 模式下启动它)。
You should be able to throw this in your .bashrc:
你应该能够把它扔到你的.bashrc:
alias vim=/Applications/MacVim.app/Contents/MacOS/vim
回答by muhmuhten
:!qis not :q!. This is probably not a bug.
:!q不是:q!。这可能不是错误。
The error message you're seeing is is most likely the result of accidentally typing :!qinstead of :q!, which would be user error, not a bug. :!qshells 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.)
您看到的错误消息很可能是不小心键入:!q而不是的结果:q!,这将是用户错误,而不是错误。:!qshells out to run q,而您的 shell ( bash) 没有找到这样的命令,并使用 127 保释。(为了比较,您可以尝试:!true, :!false, :!vim %, 来感受一下。)
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 ZQinstead of :q!; this has other disadvantages (a typo ZZwill instead save the file if it's edited, and ZQspecifically is a vim extension), but at least you see thiserror again.
对此没有真正的“修复”,并且!对于其他目的非常有用;也许通过更多的练习,你会减少打字错误的频率。您也可以尝试使用ZQ代替:q!;这还有其他缺点(ZZ如果文件被编辑,拼写错误将改为保存文件,ZQ特别是 vim 扩展名),但至少您会再次看到此错误。
The upshot here is basically check to make sure you typed in your commands right, I guess.
我猜,这里的结果基本上是检查以确保您正确输入了命令。
回答by abdollar
This is the homebrew formula for vim. Try these settings for "configure" or just install homebrew and install vim from there.
这是vim的自制公式。尝试这些“配置”设置,或者只是安装自制软件并从那里安装 vim。
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"

