Emacs和Vim之间有什么实际的、客观的区别?例如,使用一个可以做而另一个不行(或者使用一个比另一个更容易做)?为了选择一门课程,我应该知道些什么?
当前回答
我认为主要的区别在于设计目标。 VIM是UNIX的工作编辑器。 Emacs是针对GNU和lisp黑客的,所以它有一些混合的设计元素。
我在我的工作站上使用vim,而我也喜欢emacs。
其他回答
如果您经常从一个站点移动到另一个站点,或者您的工作涉及到登录到生产系统,那么vim就是合适的选择。
默认情况下,所有*nix机器都会安装vi。
大多数sysdamins更喜欢ksh作为默认shell。KSH使用vi(或emacs)命令击键来搜索历史记录并编辑命令行。
如果你不太了解vi,当你登录到一个标准配置的unix机器上时,你就会受到严重的限制。
仅仅因为这个原因,我推荐vim作为你日常的编辑器。我曾经见过emacs爱好者试图在一个基本的unix服务器上修改配置文件。
关于这两个编辑器,已经说了很多,但我只想补充我的5便士。这两个编辑器都很棒,你不会选错他们中的任何一个。
我使用vi/vim已经有15年了。我试过几次转换到emacs,但每次都发现vim实际上可以做缺少的事情,而不需要写一个lisp扩展或安装一些东西。
对我来说,编辑器的主要区别是vim让你使用环境/操作系统,而emacs试图封装它或替换它。 例如,您可以在文本中添加日期:r!日期在vim,或日历与:r!ccal1 2014,甚至用十六进制版本的内容替换缓冲区的内容。如。: % !Xxd,编辑十六进制,然后返回:%!XXD -r,以及许多其他用途,如内置grep, sed等。
另一个例子是使用jq和gron。如。将json blob粘贴到编辑器,然后运行转换:
:r!curl -s http://interesting/api/v1/get/stuff
:%!gron | grep 'interesting' | gron -u
OR
:%!jq .path.to.stuff
上面的每个管道命令都可以通过:%!<命令>,其中%表示所有文档,但也可以对选定的行等运行。这里gron输出可以作为jq路径。
您还可以获得EX批量编辑功能,例如。替换某些单词,重新格式化代码,转换dos->unix换行符,一次对100个文件运行宏。这很容易用ex完成。我不确定emacs是否有类似的东西。
换句话说,IMHO vim更接近unix哲学。它通常更简单、更小,但是如果您了解您的操作系统和工具,您可能只需要VIM提供的东西。我从来没有。
此外,vi在任何unix/linux系统上都是事实上的标准,为什么要学习使用两个做同样事情的工具呢?当然,有些系统提供mg或类似的东西,但肯定不是所有的。Unix + Vi <3。
好吧,只要我的5便士。
Emacs实际上更像是一个无所不能的程序,而vi(m)实际上只是一个编辑器。如果您正在编辑文本,它们都很好,但我更喜欢emacs,因为我必须将一个移出主行才能移动,并在命令模式中不断键入错误的内容。如果您没有这个问题,vi(m)可能是您的编辑器。
我已经在生产/研究环境中使用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的好处
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
推荐文章
- 是否有Eclipse行宽标记?
- 在Vim/Vi中,如何将光标移动到前一个单词的末尾?
- 如何在vim中自动删除尾随空格
- 为什么Vim使用~扩展名保存文件?
- 如何在Vim或Linux中将空格转换为制表符?
- 如何在编辑器(Atom, notepad++, Kate, VIM, Sublime, Textpad等)和ide (NetBeans, IntelliJ IDEA, Eclipse, Visual Studio等)中选择列
- 使用Emacs递归地查找和替换尚未打开的文本文件
- 我如何使用vimdiff来解决git合并冲突?
- 在Vim中删除当前缓冲区的文件名/路径
- Git在终端提交时打开VIM,但无法返回终端
- 请参阅编辑器中的换行符和回车
- 如何在NERDTree中显示隐藏文件(以句点开始)?
- 如何复制一个选择到OS X剪贴板
- 如何删除(不削减)在Vim?
- Vim:在可视模式下快速选择文本块的方法