Emacs和Vim之间有什么实际的、客观的区别?例如,使用一个可以做而另一个不行(或者使用一个比另一个更容易做)?为了选择一门课程,我应该知道些什么?
当前回答
我已经在生产/研究环境中使用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.
其他回答
我是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是左下角的键时,它几乎没有那么烦人。
Emacs的好处
Emacs has both non-modal interface (by default) and modal one (e.g. it can emulate vim and vi through Evil, Viper, or Vimpulse). One of the most ported computer programs. It runs in text mode and under graphical user interfaces on a wide variety of operating systems, including most Unix-like systems (Linux, the various BSDs, Solaris, AIX, IRIX, macOSetc.), MS-DOS, Microsoft Windows, AmigaOS, and OpenVMS. Unix systems, both free and proprietary, frequently provide Emacs bundled with the operating system. Emacs server architecture allows multiple clients to attach to the same Emacs instance and share the buffer list, kill ring, undo history and other state. Pervasive online help system with keybindings, functions and commands documented on the fly. Extensible and customizable Lisp programming language variant (Emacs Lisp), with features that include: A powerful and extensible file manager (dired), integrated debugger, and a large set of development and other tools. Having every command be an Emacs Lisp function enables commands to DWIM (Do What I Mean) by programmatically responding to past actions and document state. For example, a switch-or-split-window command could switch to another window if one exists, or create one if needed. This cuts down on the number of keystrokes and commands a user must remember. "An OS inside an OS". Emacs Lisp enables Emacs to be programmed far beyond editing features. Even a base install contains several dozen applications, including two web browsers, news readers, several mail agents, four IRC clients, a version of ELIZA, and a variety of games. All of these applications are available anywhere Emacs runs, with the same user interface and functionality. Starting with version 24, Emacs includes a package manager, making it easy to install additional applications including alternate web browsers, EMMS (Emacs Multimedia System), and more. Also available are numerous packages for programming, including some targeted at specific language/library combinations or coding styles.
vi类编辑器的好处
Edit commands are composable Vi has a modal interface (which Emacs can emulate) Historically, vi loads faster than Emacs. While deeply associated with UNIX tradition, it runs on all systems that can implement the standard C library, including UNIX, Linux, AmigaOS, DOS, Windows, Mac, BeOS, OpenVMS, IRIX, AIX, HP-UX, BSD and POSIX-compliant systems. Extensible and customizable through Vim script or APIs for interpreted languages such as Python, Ruby, Perl, and Lua Ubiquitous. Essentially all Unix and Unix-like systems come with vi (or a variant) built-in. Vi (and ex, but not vim) is specified in the POSIX standard. System rescue environments, embedded systems (notably those with busybox) and other constrained environments often include vi, but not emacs.
来源:https://en.wikipedia.org/wiki/Editor_war
现在你甚至不需要考虑这两者之间的区别,因为Spacemacs。它是一个社区驱动的Emacs发行版。
正如它所说,
最好的编辑器既不是Emacs也不是vim,而是Emacs和vim。
Spacemacs结合了Emacs和Vim的优点,使您的生活和工作更加轻松。
请看下面的截图,
(来源:spacemacs.org)
我已经在生产/研究环境中使用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.
我想引用《UNIX编程的艺术》一书中的一段话:
Many people who regularly use both vi and Emacs tend to use them for different things, and find it valuable to know both. In general, vi is best for small jobs – quick replies to mail, simple tweaks to system configuration, and the like. It is especially useful when you’re using a new system (or a remote one over a network) and don’t have your Emacs customization files handy. Emacs comes into its own for extended editing sessions in which you have to handle complex tasks, modify multiple files, and use results from other programs during the session. For programmers using X on their console (which is typical on modern Unixes), it’s normal to start up Emacs shortly after login time in a large window and leave it running forever, possibly visiting dozens of files and even running programs in multiple Emacs subwindows.
我在这里真正想强调的是:“许多人发现两者都知道是有价值的。
推荐文章
- 我如何使用vimdiff来解决git合并冲突?
- 在Vim中删除当前缓冲区的文件名/路径
- Git在终端提交时打开VIM,但无法返回终端
- 请参阅编辑器中的换行符和回车
- 如何在NERDTree中显示隐藏文件(以句点开始)?
- 如何复制一个选择到OS X剪贴板
- 如何删除(不削减)在Vim?
- Vim:在可视模式下快速选择文本块的方法
- 是否有vim命令来重新定位一个选项卡?
- MacVim和普通Vim有什么区别?
- 如何使Sublime Text成为Git的默认编辑器?
- 有什么方法可以在Vim中查看当前映射的键吗?
- 同一行上有多个命令
- 如何将所有文本转换为小写在Vim
- 使用vimdiff查看所有' git diff '