Emacs和Vim之间有什么实际的、客观的区别?例如,使用一个可以做而另一个不行(或者使用一个比另一个更容易做)?为了选择一门课程,我应该知道些什么?


当前回答

Seems an answer has been selected already, but the big difference to me has always been the modal vs. non-modal. Vim is modal, which means that it makes optimizations based on a specific set of usage modes. At least that's how I've always looked at it. This makes using Vim a different experience because instead of having a work area that you type code in, you really are telling an environment to act on the text. This is why people say things like with Vim you really are learning a language. The :wq and :s/foo/bar is all part of a shell like environment that edits and reads text.

Emacs on the other hand is much closer to most editors/word processors/etc. you see today. You have a workspace that has a highly programmable interface. That is why you see things like email, irc, shells, etc. As a programmer it is easy to think in terms of saying "take the line number I'm on and do something with the information". The desire to leave the editor becomes less because instead of having to quit, open some other app/language and do things on some text, you have Emacs where you can do these things within the scope of your editor.

这两种观点并不一定是对立的,只是它们揭示了两个不同的焦点。就我个人而言,我使用Emacs,但我见过非常了解Vim的人,他们可以诚实地说,选择哪种并不重要。我首先尝试了Vim,但Emacs最终支持了我。的确,无论您选择什么,您都应该至少在一定程度上精通Vim,因为它总是可用的。

其他回答

对我来说,emacs有更好的开发工具(不仅仅是基于标记的工具)。

Cedet(c/c++) Xrefactory(c/c++/java) 史莱姆(普通口齿) JDEE(java) 欧洲央行(代码浏览器) GDB 支持 NXML(xml)

在日常层面上有巨大的区别——Vim(或任何vi变体)本质上是模态的(你进入命令模式,但你不能编辑),而Emacs(以及大多数其他编辑器)不是。

当然,使用菜单之类的东西,你不需要在Vim中实际进入命令模式——首先。但即使使用Vim的一小部分力量,你也会。这是Vim/Emacs争论的核心。

就我个人而言,我还认为Emacs的可扩展性要强得多。你可以找到很多东西的Elisp包。

不过,我很好奇,为什么您考虑学习其中一种而不是更传统的IDE。你为什么要学这个?

我是Emacs的粉丝,但我鼓励其他开发人员学习VI,因为:

你可以使用VI编辑emacs的makefile文件。 VI包含ed命令,每个UNIX用户都应该知道ed和sed。

我注意到一些关于VIM启动速度比emacs快的评论。如果您真的关心这个问题,请在服务器模式下运行emacs,并将“emacs”别名为“emacsclient”。客户端速度非常快,因为它所做的一切都是轻拍服务器的肩膀,告诉它你想编辑哪个文件。在MacOSX上,emacsclient只有33K,而emacs是287M。

我不确定这些在现代硬件上是否有必要。在我的MacBook Pro (2013 Retina)上,当我从shell运行emacs时,它几乎是立即加载的。我丝毫没有察觉到停顿。当我运行Emacs时。app (GUI版本)可能需要3秒。

我听到的大多数关于emacs的抱怨似乎都来自那些对emacs不了解的人。我从1982年就开始使用vi和emacs了,我清楚地记得,在我早期的UNIX机器中,emacs加载速度比vi慢得多,并且占用了大部分物理内存,但现在已经不再是这样了,至少15-20年都没有了。

我承认的一个抱怨是“emacs小指”。在我年轻的时候,这从来没有困扰过我。现在我已经58岁了,我的小手指确实因为反复使用Control键进行emacs和弦而有点酸痛。在MacBook Pro的键盘上尤其如此,“控制”键向右移动了一个位置,为“fn”键腾出空间。当Control是左下角的键时,它几乎没有那么烦人。

在你的问题中,你没有提到你想让它用Lisp编程!但是当你评论你的回答时,我明白你实际上想要一个LISP编程接口。

对于这个精确的任务,忘记Vi吧。Emacs与LISP的集成非常棒!你应该使用SLIME。然后,您将与REPL进行出色的集成,能够将函数、缓冲区或文件直接计算到emacs缓冲区中运行的解释器中,以及更多…

If you are looking for an objective analysis of both the editors, look at their origins and the philosophy behind their respective designs. Think, which one would suit you better and learn it (and learn it and learn it, because it takes time before you being to discover its true utility as against any IDE). An Introduction to Display Editing with Vi was written by Bill Joy and Mark Horton and he explains why he choose modal design and rationale for various key strokes ( it helps me to remember that CTRL-W +W (will switch to next Window and it will same for CTRL W+ CTRL W, just in case you held the CTRL key for a longer duration.

这里有一个Emacs时间轴的链接,并有对Multics Emacs论文的参考。这是一篇关于Emacs的RMS论文,我看到重点在可编程文本编辑器上(甚至早在1981年或更早的时候)。

我没有读过emacs的论文,但是读过Bill Joy的vi论文几次。 两者都是旧的,但你仍然会得到哲学,你可以选择使用当前的工具(vim 7。X还是emacs 25?)

编辑:我忘了说,阅读这两篇论文需要耐心和想象力,因为它会让你在阅读时回到过去。但这是值得的。