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


当前回答

我是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是左下角的键时,它几乎没有那么烦人。

其他回答

我认为主要的区别在于设计目标。 VIM是UNIX的工作编辑器。 Emacs是针对GNU和lisp黑客的,所以它有一些混合的设计元素。

我在我的工作站上使用vim,而我也喜欢emacs。

对我来说,emacs的优点是,

tramp模式允许您通过ssh编辑远程文件。就像本地文件一样。 Tramp-mode + dired =全功能SFTP客户端 支持您需要的所有语言。 内置的终端模拟器(术语模式),所以我可以继续编码,而无需在应用程序之间切换。 可扩展性任何你不喜欢的东西都可以用lisp来改变。

我已经在生产/研究环境中使用spacemacs大约2年,neovim大约1年。Spacemacs是带有一些额外功能的emacs,比如图层等。neovim又是vim的一个分支,具有一些额外的特性。

就经验而言,我对他们俩都不太满意。我仍然在寻找一个长期的解决方案来满足我的文本编辑需求。

这里有一个简单的对比:

Neovim, vim, emacs, spacemacs, etc all of those editors consume less ressources compared to most of the editors out there. Neovim/vim is slightly faster than emacs, noticably faster than spacemacs. In terms of editing experience. I can easily say that emacs packages feel superior. I think that's because they blend in better with the core of emacs. Vimscript is nice and there are certainly great projects in the vim ecosystem as well. The good thing is they are better documented than most emacs projects I have seen so far. Both can be glitchy depending on the package you are using. Spacemacs tend to freeze, and neovim tend to display scary error messages, so pick your poison there. Modal editing in vim, is not an intuitive concept, but once you get used to it, you want it anywere. Both of the editor provide that.

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?)

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

Emacs具有Viper模式,因此在某种意义上,它提供了一个超特性集(除了那些在使用Viper和Vimpulse的Emacs中缺少哪些Vim特性?)

vi(和VIM IIRC)的重量较轻(它可以就地编辑文件),但提供的功能较少(子进程通信、扩展语言)。