我已经安装了MacVim,我正试图将其设置为Git(版本控制)的编辑器,但我不能从命令行运行“mvim”,因为它不被识别。我如何设置mvim,以便我可以从终端运行它?


当前回答

In addition, if you want to use MacVim (or GVim) as $VISUAL or $EDITOR, you should be aware that by default MacVim will fork a new process from the parent, resulting in the MacVim return value not reaching the parent process. This may confuse other applications, but Git seems to check the status of a temporary commit message file, which bypasses this limitation. In general, it is a good practice to export VISUAL='mvim -f' to ensure MacVim will not fork a new process when called, which should give you what you want when using it with your shell environment.

其他回答

我强烈建议通过MacPorts安装MacVim (sudo port install MacVim)。

当安装时,MacPorts会自动更新你的配置文件以包含/opt/local/bin在你的路径中,所以当mvim在安装MacVim期间被安装为/opt/local/bin/mvim时,你会发现它可以直接使用。

当你安装MacVim端口时,MacVim。app bundle也安装在/Applications/MacPorts中。

走MacPorts路线的一个好处是,你也可以安装git (sudo port install git-core)和许多其他端口。强烈推荐。

在.bz2文件的根目录下应该有一个名为mvim的脚本。把它复制到你的$PATH (/usr/local/bin会很好),你应该排序。

假设MacVim安装在Application文件夹中。

不要在你的环境中添加MacVim路径,而是在terminal中输入以下命令创建一个链接:

sudo ln -s /Applications/MacVim。应用程序/内容/ bin / mvim /usr/local/bin/mvim

然后,打开一个新的终端窗口/选项卡,输入mvim。

我不认为我需要在路径上添加任何东西

brew install macvim

mvim -v

然后应该打开macvim在终端,你也可以继续和别名吗

alias vim='mvim -v'

In addition, if you want to use MacVim (or GVim) as $VISUAL or $EDITOR, you should be aware that by default MacVim will fork a new process from the parent, resulting in the MacVim return value not reaching the parent process. This may confuse other applications, but Git seems to check the status of a temporary commit message file, which bypasses this limitation. In general, it is a good practice to export VISUAL='mvim -f' to ensure MacVim will not fork a new process when called, which should give you what you want when using it with your shell environment.