简体   繁体   English

MacVim 和常规 Vim 有什么区别?

[英]What is the difference between MacVim and regular Vim?

I'm reasonably new to OS X, but I'm familiar with Vim from using it in various *nix systems.我对 OS X 相当陌生,但我熟悉 Vim 在各种 *nix 系统中使用它。 I've seen many people recommend running MacVim over Vim in the terminal.我见过很多人建议在终端中通过 Vim 运行 MacVim。 Can anyone tell me what differences there are between MacVim and regular Vim?谁能告诉我 MacVim 和常规 Vim 之间有什么区别?

MacVim is just Vim. MacVim只是 Vim。 Anything you are used to do in Vim will work exactly the same way in MacVim.你以前在 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)输入和离开一个 realm(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 filename and 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.当我从 TextMate 切换时,我有点喜欢 MacVim 支持 Mac 用户习惯的几乎所有常规快捷方式这一事实。 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.我添加了一些我自己的,模仿 TextMate,但由于我在多个环境中工作,我强迫自己学习 vim 方式。 Now I use both MacVim and Vim almost exactly the same way.现在我使用 MacVim 和 Vim 的方式几乎完全相同。 Using one or the other is just a question of context for me.使用其中一个对我来说只是一个上下文问题。

Also, like El Isra said, the default vim (CLI) in OS X is slightly outdated.此外,就像 El Isra 所说,OS X 中的默认 vim (CLI) 有点过时了。 You may install an up-to-date version via MacPorts or you can install MacVim and add an alias to your .profile :您可以通过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 中开箱即用,但在 Terminal.app 中看起来很糟糕,它只支持 8 个 colors(+ 高亮),但你可以使用iTerm——它可以设置为支持 256 个 colors——而不是的终端。

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.编辑:我没有尝试过,但最新版本的 Terminal.app(在 10.7 中)应该支持 256 colors。 I'm still on 10.6.x at work so I'll still use iTerm2 for a while.我仍在工作中使用 10.6.x,所以我仍会使用 iTerm2 一段时间。

EDIT: An even better way to use MacVim's CLI executable in your shell is to move the mvim script bundled with MacVim somewhere in your $PATH and use this command:编辑:在 shell 中使用 MacVim 的 CLI 可执行文件的更好方法是将与 MacVim 捆绑的mvim脚本移动到$PATH中的某个位置并使用以下命令:

$ mvim -v

EDIT: Yes, Terminal.app now supports 256 colors.编辑:是的,Terminal.app 现在支持 256 colors。 So if you don't need iTerm2's advanced features you can safely use the default terminal emulator.因此,如果您不需要iTerm2 的高级功能,您可以安全地使用默认的终端仿真器。

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 和我的应用程序的 rest 之间复制粘贴。

unfortunately, with "mvim -v", ALT plus arrow windows still does not work.不幸的是,使用“mvim -v”,ALT 加箭头 windows 仍然不起作用。 I have not found any way to enable it:-(我还没有找到任何方法来启用它:-(

It's all about the key bindings which one can simply achieve from.vimrc configurations.这都是关于可以从.vimrc 配置中简单地实现的键绑定。 As far as clipboard is concerned you can use :set clipboard unnamed and the yank from vim will go to system clipboard.就剪贴板而言,您可以使用:set clipboard unnamed并且从 vim 将 go 拉到系统剪贴板。 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 配置,它包含大量的插件和绑定,这将使你的体验更加流畅。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM