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


当前回答

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

其他回答

如果您经常从一个站点移动到另一个站点,或者您的工作涉及到登录到生产系统,那么vim就是合适的选择。

默认情况下,所有*nix机器都会安装vi。

大多数sysdamins更喜欢ksh作为默认shell。KSH使用vi(或emacs)命令击键来搜索历史记录并编辑命令行。

如果你不太了解vi,当你登录到一个标准配置的unix机器上时,你就会受到严重的限制。

仅仅因为这个原因,我推荐vim作为你日常的编辑器。我曾经见过emacs爱好者试图在一个基本的unix服务器上修改配置文件。

对我来说,emacs的优点是,

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

我想引用《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.

我在这里真正想强调的是:“许多人发现两者都知道是有价值的。

Vim不是一个壳。而且它不能很好地与子进程通信。这几乎是设计的,而在Emacs中,这些元素是设计包含的。这意味着有些东西,比如嵌入调试器或解释器(产生某种IDE),在Vim中是很困难的。

此外,Emacs快捷方式主要是通过修饰符访问的,显然Vim接口是出了名的模态接口,可以访问大量的直接键进行操作。

Emacs曾经是这两个编辑器中唯一可编程的编辑器,而Vim的可编程性有很多奇怪的级别,添加了Python和Ruby绑定(还有更多,我忘记了),Vim也可以以您所关心的大多数方式进行可编程。

我使用Vim,而且我对它相当满意。

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

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