macos MacVim 和普通 Vim 有什么区别?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/5892547/
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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-21 08:02:17  来源:igfitidea点击:

What is the difference between MacVim and regular Vim?

macosvimtext-editormacvim

提问by Mark Costello

I'm reasonably new to OS X, but I'm familiar with Vim from using it in various *nix systems. I've seen many people recommend running MacVim over Vim in the terminal. Can anyone tell me what differences there are between MacVim and regular Vim?

我对 OS X 相当陌生,但我熟悉 Vim,因为它在各种 *nix 系统中使用它。我看到很多人推荐在终端中通过 Vim 运行 MacVim。谁能告诉我 MacVim 和普通 Vim 之间有什么区别?

采纳答案by romainl

MacVimis just Vim. Anything you are used to do in Vim will work exactly the same way in MacVim.

MacVim只是 Vim。你习惯在 Vim 中做的任何事情在 MacVim 中都会以完全相同的方式工作。

MacVim is more integrated in the whole OS than Vim in the Terminal or even GVim in Linux, it follows a lot of Mac OS X's conventions.

MacVim 与终端中的 Vim 甚至 Linux 中的 GVim 相比,在整个操作系统中的集成度更高,它遵循了许多 Mac OS X 的约定。

If you work mainly with GUI apps (YummyFTP+ GitX+ Charles, for example) you may prefer MacVim.

如果您主要使用 GUI 应用程序(例如 YummyFTP+ GitX+ Charles),您可能更喜欢 MacVim。

If you work mainly with CLI apps (ssh + svn + tcpdump, for example) you may prefer vim in the terminal.

如果您主要使用 CLI 应用程序(例如 ssh + svn + tcpdump),您可能更喜欢终端中的 vim。

Entering and leaving one realm (CLI) for the other (GUI) and vice-versa can be "expensive".

为另一个 (GUI) 进入和离开一个领域 (CLI),反之亦然可能是“昂贵的”。

I use both MacVim and Vim depending on the task and the context: if I'm in CLI-land I'll just type vim filenameand if I'm in GUI-land I'll just invoke Quicksilver and launch MacVim.

我根据任务和上下文同时使用 MacVim 和 Vim:如果我在 CLI 环境中,我将只输入vim filename,如果我在 GUI 环境中,我将调用 Quicksilver 并启动 MacVim。

When I switched from TextMate I kind of liked the fact that MacVim supported almost all of the regular shortcuts Mac users are accustomed to. I added some of my own, mimiking TextMate but, since I was working in multiple environments I forced my self to learn the vim way. Now I use both MacVim and Vim almost exactly the same way. Using one or the other is just a question of context for me.

当我从 TextMate 切换时,我有点喜欢 MacVim 支持几乎所有 Mac 用户习惯的常规快捷方式的事实。我添加了一些我自己的,模仿 TextMate 的,但是,因为我在多个环境中工作,所以我强迫自己学习 vim 的方式。现在我使用 MacVim 和 Vim 的方式几乎完全相同。使用其中一个对我来说只是上下文问题。

Also, like El Isra said, the default vim (CLI) in OS X is slightly outdated. You may install an up-to-date version via MacPortsor you can install MacVim and add an alias to your .profile:

此外,正如 El Isra 所说,OS X 中的默认 vim (CLI) 有点过时了。您可以通过MacPorts安装最新版本,也可以安装 MacVim 并向您的.profile:

alias vim='/path/to/MacVim.app/Contents/MacOS/Vim'

to have the same vim in MacVim and Terminal.app.

在 MacVim 和 Terminal.app 中使用相同的 vim。

Another difference is that many great colorschemes out there work out of the box in MacVim but look terrible in the Terminal.app which only supports 8 colors (+ highlights) but you can use iTerm— which can be set up to support 256 colors — instead of Terminal.

另一个区别是,MacVim 中的许多出色的配色方案都是开箱即用的,但在仅支持 8 种颜色(+ 高光)的 Terminal.app 中看起来很糟糕,但您可以使用iTerm(可以设置为支持 256 种颜色)来代替的终端。

So… basically my advice is to just use both.

所以……基本上我的建议是两者都用。

EDIT:I didn't try it but the latest version of Terminal.app (in 10.7) is supposed to support 256 colors. I'm still on 10.6.x at work so I'll still use iTerm2 for a while.

编辑:我没有尝试过,但最新版本的 Terminal.app(在 10.7 中)应该支持 256 色。我还在 10.6.x 上工作,所以我仍然会使用 iTerm2 一段时间。

EDIT:An even better way to use MacVim's CLI executable in your shell is to move the mvimscript bundled with MacVim somewhere in your $PATHand use this command:

编辑:在 shell 中使用 MacVim 的 CLI 可执行文件的更好方法是将mvim与 MacVim 捆绑在一起的脚本移动到您的某个位置$PATH并使用以下命令:

$ mvim -v

EDIT:Yes, Terminal.app now supports 256 colors. So if you don't neediTerm2's advanced features you can safely use the default terminal emulator.

编辑:是的,Terminal.app 现在支持 256 种颜色。因此,如果您不需要iTerm2 的高级功能,您可以安全地使用默认的终端模拟器。

回答by Janac Meena

The one reason I have which made switching to MacVim worth it: Yank uses the system clipboard.

我认为值得切换到 MacVim 的一个原因是:Yank 使用系统剪贴板。

I can finally copy paste between MacVim on my terminal and the rest of my applications.

我终于可以在我的终端上的 MacVim 和我的其他应用程序之间复制粘贴了。

回答by Daniel Pinyol

unfortunately, with "mvim -v", ALT plus arrow windows still does not work. I have not found any way to enable it :-(

不幸的是,使用“mvim -v”,ALT 加箭头窗口仍然不起作用。我还没有找到任何启​​用它的方法:-(

回答by Manish Baghel

It's all about the key bindings which one can simply achieve from .vimrc configurations. As far as clipboard is concerned you can use :set clipboard unnamedand the yank from vim will go to system clipboard. Anyways, whichever one you end up using I suggest using this vimrc config, it contains a whole lot of plugins and bindings which will make your experience smooth.

这完全是关于可以从 .vimrc 配置中简单实现的键绑定。就剪贴板而言,您可以使用:set clipboard unnamed并且 vim 的 yank 将转到系统剪贴板。无论如何,无论你最终使用哪个,我建议使用这个 vimrc config,它包含大量插件和绑定,这将使你的体验顺畅。