Emacs和Vim之间有什么实际的、客观的区别?例如,使用一个可以做而另一个不行(或者使用一个比另一个更容易做)?为了选择一门课程,我应该知道些什么?
当前回答
这就像苹果和橘子。两者都有不同的设计和理念。Vim是一个文本编辑器,而Emacs是一个Lisp解释器,可以进行文本编辑。
我使用Vim是因为它快速、狡猾,而且非常擅长处理文本。它具有可组合的自然键绑定,可以使您的开发任务真正协调一致。Vim基于一种简单的*nix哲学,即做好一件事——即文本操作。
使用bash/zsh和tmux扩展Vim通常很简单,可以学到很多东西。恕我直言,这是一个很好的学习曲线。关键是要学习如何集成这些东西以获得更大的工作应用程序。使用Vim,您需要学习集成,因为除非您告诉它如何进行集成,否则它不会自然地进行集成。另一个值得我使用的扩展是Tig。它是一个基于ncurses的Git前端。我只是有一个绑定,它无声地打开Tig,然后我在那里做所有Git的事情。
由最终用户来决定什么是最好的。Emacs和Vim经受住了时间的考验,证明了它们的价值。最终,一个优秀的程序员只需要一支笔和一张纸就可以发挥创造力。好的算法不需要编辑器的支持。所以两种方法都试试,看看哪种方法能让你更有效率。从这两个软件中学习设计模式,因为有很多东西需要学习和发现!
其他回答
在你的问题中,你没有提到你想让它用Lisp编程!但是当你评论你的回答时,我明白你实际上想要一个LISP编程接口。
对于这个精确的任务,忘记Vi吧。Emacs与LISP的集成非常棒!你应该使用SLIME。然后,您将与REPL进行出色的集成,能够将函数、缓冲区或文件直接计算到emacs缓冲区中运行的解释器中,以及更多…
Vim was always faster to start up than Emacs. I'm saying that on any machine, out-of-the-box installs of Vim will start up faster than out-of-the-box installs of Emacs. And I tend to think that after a moderate amount of customisation of either one, Vim will still start up faster than Emacs. After that, the other practical difference was Emacs' modes. They make your life tremendously easier when editing XML, C/C++/Java/whatever, LaTeX, and most popular languages you can think of. They make you want to keep the editor open for long sessions and work.
总而言之,我会说Vim让您使用它来完成简短、快速的编辑任务;而Emacs则鼓励您投入长时间的会话。
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大约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.
我在这里真正想强调的是:“许多人发现两者都知道是有价值的。