Emacs 或 Vim 与 Eclipse 相比,效率如何?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/1346820/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
What are the efficiencies afforded by Emacs or Vim vs Eclipse?
提问by gav
I started coding around 5 years ago. I was introduced through Java and Eclipse which both have substantial stigma attached in the programming community. A number of people at the company I currently intern at prefer emacs or vim. I can't see how a basic text editor is faster or easier than an IDE in general although I appreciate some things like building tend to be faster from the command line.
我大约在 5 年前开始编码。我是通过 Java 和 Eclipse 被介绍的,这两种语言在编程社区中都有很大的烙印。我目前实习的公司中的许多人更喜欢 emacs 或 vim。我看不出基本的文本编辑器如何比 IDE 更快或更容易,尽管我很欣赏一些东西,比如从命令行构建往往更快。
Is this a case of the 'old-boys' club or can it be more efficient to program a project in this way?
这是“老男孩”俱乐部的情况还是以这种方式对项目进行编程会更有效率?
Can you provide some use cases to demonstrate? If I were advocating Eclipse I'd say refactoring and auto-completion were pretty handy tools.
你能提供一些用例来演示吗?如果我提倡 Eclipse,我会说重构和自动完成是非常方便的工具。
Gav
加夫
采纳答案by Aram Verstegen
I got started in IDEs like Eclipse, but switched to Vim about 2 years ago.
我开始使用 Eclipse 等 IDE,但大约 2 年前切换到 Vim。
Reasons you may want to use a text-mode editor:
您可能想要使用文本模式编辑器的原因:
- It can be used as an IDE for just about any language (you learn it once and use it for everything)
- It can do all those fancy things like auto-completion, refactoring and many more complex operations, which you can extend by adding macros or plug-ins
- It works just about everywhere (and can be used through an SSH shell)
- You don't need a GB of ram to run it
- 它几乎可以用作任何语言的 IDE(您只需学习一次,就可以将其用于所有语言)
- 它可以完成所有那些花哨的事情,例如自动完成、重构和许多更复杂的操作,您可以通过添加宏或插件来扩展这些操作
- 它几乎适用于任何地方(并且可以通过 SSH shell 使用)
- 你不需要 GB 的内存来运行它
If you really persevere, you will find that working in an editor like this will eventually be faster, and in fact becomes ingrained as a sort of 'muscle memory'. This means you can code without slowing down to think about the process.
如果你真的坚持下去,你会发现在这样的编辑器中工作最终会更快,实际上成为一种根深蒂固的“肌肉记忆”。这意味着您可以编码而不会放慢速度来考虑过程。
回答by Corey D
Vim / Emacs
Vim/Emacs
- Very fast/efficient code writing
- Low memory footprint
- Quick access to command line
- Infinite possibilities through scripting/plugins
- Never have to leave the keyboard
- 非常快速/高效的代码编写
- 低内存占用
- 快速访问命令行
- 通过脚本/插件的无限可能性
- 永远不必离开键盘
Eclipse
蚀
- Full-featured IDE for manylanguages
- Great refactoring support
- 全功能IDE多语言
- 强大的重构支持
All of them
他们都
- Cross-platform
- Feature rich
- Extensible through plugins
- 跨平台
- 功能丰富
- 可通过插件扩展
I typically find myself writing volumes of code through vim
and performing debugging tasks through my IDE. Familiarity with the code base is certainly a factor, as an IDE is a great tool for jumping around and learning unfamiliar source code.
我通常会发现自己vim
通过我的 IDE编写大量代码并执行调试任务。熟悉代码库当然是一个因素,因为 IDE 是跳来跳去和学习不熟悉的源代码的好工具。
回答by DigitalRoss
The argument "Eclipse for Java" is a different argument than "Eclipse for [something that isn't java]". Eclipse does rock for Java.
参数“Eclipse for Java”与“Eclipse for [something that is not java]”不同。Eclipse 确实适用于 Java。
I mean, vi is like a screwdriver, or maybe a swiss army knife, and Eclipse is like a big CNC combo mill and asphalt spreader. You don't exactly compare them, you kind of just use both.
我的意思是,vi 就像一把螺丝刀,或者可能是一把瑞士军刀,而 Eclipse 就像一个大型 CNC 组合磨机和沥青撒布机。你不完全比较它们,你只是使用两者。
Also, are you working inside something giant, which you know little about, but which Eclipse understands? An example would be working on Eclipse itself. Here, Eclipse has perfect visibility, total language support, and you need the toast prompts and the documentation links.
此外,您是否在一些您不了解但 Eclipse 理解的巨大事物中工作?一个例子是在 Eclipse 本身上工作。在这里,Eclipse 具有完美的可见性、全面的语言支持,并且您需要 toast 提示和文档链接。
But if you are typing in a 100-line Ruby program to convert an SQL database, Eclipse doesn't add much value, especially considering its baggage.
但是如果您正在输入一个 100 行的 Ruby 程序来转换 SQL 数据库,那么 Eclipse 并没有增加多少价值,尤其是考虑到它的包袱。
It's also critical to set up vi right, or you won't grok the appeal. Autoindent, showmatch, tab handling, and various other options should be set. You should have a easy way to generate a tags file. Google can find tag generators, or just write one from scratch, with a few lines of shellcode and sed(1).
正确设置 vi 也很重要,否则您将无法理解这种吸引力。应设置自动缩进、显示匹配、选项卡处理和各种其他选项。您应该有一种简单的方法来生成标签文件。谷歌可以找到标签生成器,或者只用几行 shellcode 和 sed(1) 从头开始编写一个。
I don't consider refactoring to be a criteria. That's not something you do once an hour or even once a day. Sure, fire up the big IDE when you need to refactor. Oh, and don't expect automated refactoring of anything except Java.
我不认为重构是一个标准。这不是你每小时甚至一天做一次的事情。当然,当您需要重构时启动大型 IDE。哦,不要指望自动重构除了 Java 之外的任何东西。
Finally, vi can actually do a lot of things that the IDE can't begin to do. The grouped regular expression global substitution is kind of a generalized refactor-anything engine. To appreciate the vi gestalt you need to learn the line (":") mode. Briefly, it's like having sed(1) inside your editor.
最后,vi其实可以做很多IDE开始做不到的事情。分组的正则表达式全局替换是一种通用的重构引擎。要欣赏 vi 格式塔,您需要学习行 (":") 模式。简而言之,这就像在您的编辑器中安装了 sed(1)。
回答by Trey Hymanson
It all depends on what you want/expect and what your usage model is.
这完全取决于您想要/期望什么以及您的使用模型是什么。
If you're looking for a Java IDE, Eclipse is difficult to beat. It's written in Java, for Java, by Java folks.
如果您正在寻找 Java IDE,那么 Eclipse 很难被击败。它是由 Java 人员用 Java 编写的,用于 Java。
If you're looking for a tool to edit files from the command line quickly, Emacs or vi both fit the bill.
如果您正在寻找从命令行快速编辑文件的工具,Emacs 或 vi 都适合。
If you're looking for a tool from which you never have to leave because it can do anything you want (send/read mail, manage projects, todo lists, compile, debug, etc. etc. etc.), then Emacs is more "efficient".
如果您正在寻找一种永远不必离开的工具,因为它可以做您想做的任何事情(发送/阅读邮件、管理项目、待办事项列表、编译、调试等),那么 Emacs 更合适“高效的”。
If you're looking for reasons to switch editors, figure out what you want. If you want a better Eclipse, vi and Emacs won't give you that, stick to Eclipse.
如果您正在寻找切换编辑器的理由,请弄清楚您想要什么。如果您想要更好的 Eclipse,vi 和 Emacs 不会给您,请坚持使用 Eclipse。
If you're looking for a small, nimble editor, vi will fit the bill.
如果您正在寻找一个小巧灵活的编辑器,vi 将适合您。
If you're looking for the ultimately extensible editor, Emacs is the way.
如果您正在寻找最终可扩展的编辑器,Emacs 就是您的选择。
Whichever tool you decide to go with, immerse yourself. Learn all of the ins and outs, extend it to meet your needs. Use it to its limits and become efficient in its use.
无论您决定使用哪种工具,都要沉浸其中。了解所有的来龙去脉,扩展它以满足您的需求。最大限度地使用它并提高其使用效率。
回答by RC.
Emacs can be a powerful IDE, but having gone from Emacs to Eclipse, I have to say I would never go back. Eclipse just offers so many features that you can't get within Emacs.
Emacs 可以是一个强大的 IDE,但从 Emacs 到 Eclipse,我不得不说我永远不会回去。Eclipse 提供了许多 Emacs 无法获得的功能。
Mylyn and scoped views of the data and files I'm using, the debugging UI, CVS UI, are all built in and easy to get and use. I'll use the mouse a little to get'em.
我正在使用的数据和文件的 Mylyn 和范围视图、调试 UI、CVS UI 都是内置的,并且易于获取和使用。我会用鼠标来获取它们。
回答by mike
First things first. VIM is more productive for programming than Eclipse. Your personal productity in VIM may be abysmal, but the potential cap of VIM is much higher. This is a fact.
先说第一件事。VIM 在编程方面比 Eclipse 更有效率。你在 VIM 中的个人生产力可能很糟糕,但 VIM 的潜在上限要高得多。这是事实。
VIM is a martial art. It feels unnatural when you first use it. And you can't even make it work. It takes years of practice to gradually become productive. You focus on mastering a little detail at first. Slowly all these bits you master add up until text is flowing effortlessly out of your finger tips onto the screen. Complicated edits that would make your co-worker sigh will jump from your hands before he can finish his exhale. There are few people who can use VIM. Fewer who can use it productivley. And you may never meet a master in your life time. But they are rumored to exist.
VIM 是一种武术。第一次使用时感觉不自然。你甚至不能让它工作。需要多年的实践才能逐渐变得富有成效。一开始你专注于掌握一些细节。慢慢地,您掌握的所有这些位加起来,直到文本毫不费力地从您的指尖流到屏幕上。会让您的同事叹息的复杂编辑会在他完成呼气之前从您的手中跳出。很少有人会使用VIM。更少的人可以使用它生产。而且你可能一辈子都不会遇到大师。但据传它们确实存在。
VIM is designed to keeep your hands on home-row. Moving your hand from the keyboard to the mouse is demoralizing. It's a gross motor movement. Moving your arm has a phsycological effect that hurts your motivation. Using VIM, someone could bolt your wrists onto the keyboard and you could still easily open up files, split windows, open tabs, build the project, search/replace, change fonts, change colors, etc. And all at lightning speed.
VIM 旨在让您的手保持在本垒打。将您的手从键盘移到鼠标上会令人沮丧。这是一个粗大的运动。移动你的手臂会产生心理效应,会损害你的动力。使用 VIM,有人可以将您的手腕固定在键盘上,您仍然可以轻松地打开文件、拆分窗口、打开选项卡、构建项目、搜索/替换、更改字体、更改颜色等。一切都以闪电般的速度进行。
VIM is modal. That means you don't have to do complex key combinations where you hold down control+shift+Key. This hurts your hands in the long run. Instead you execute commands. There is no need for key combos to due to the modal nature.
VIM 是模态的。这意味着您不必在按住 control+shift+Key 的情况下进行复杂的组合键。从长远来看,这会伤害你的手。相反,您执行命令。由于模态性质,不需要关键组合。
We store data in our memory like computers do. Our memory can only hold a few values at a time. See how many distinct integers you can hold in your head before they start to slip away. We overcome this human limitation by writing stuff down. If data falls out of our memory we can easily look at what we wrote down to get it back. If your time is spent doing gross motor, physical things you are losing time that could have been spent on processing data in your brain. You want your mind to flow onto the screen without any effort at all. It may not sound like much but VIM's ability to effortlessly transfer what is in your mind to the screen is a BIG productivity boost. It's hard to put in words what I'm trying to say.
我们像计算机一样将数据存储在内存中。我们的内存一次只能保存几个值。看看在它们开始溜走之前,您可以在脑海中记住多少个不同的整数。我们通过写下东西来克服这种人为限制。如果数据从我们的记忆中掉出来,我们可以很容易地查看我们写下的内容以将其取回。如果你的时间花在了大运动、身体上,你就会浪费时间来处理大脑中的数据。你想让你的思想毫不费力地流到屏幕上。这听起来可能并不多,但 VIM 能够毫不费力地将您的想法转移到屏幕上,这极大地提高了生产力。很难用语言表达我想说的话。
VIM supports code completion. Both textual and look-up based. It can pull text from mulitple files. Anything you desire can be had in VIM. Either make it yourself or use something someone else cooked up.
VIM 支持代码完成。基于文本和查找。它可以从多个文件中提取文本。你想要的任何东西都可以在 VIM 中得到。要么自己做,要么用别人做的东西。
VIM supports goign to definitions with ctags. You can also find all references of an item. Again, anything you desire can be had in VIM.
VIM 支持使用 ctags 转到定义。您还可以找到一个项目的所有参考。同样,你想要的任何东西都可以在 VIM 中得到。
The scripting of VIM is huge. You can download or create thousands of color schemes and change colors in an instant. Try to change fonts or colors in Microsoft Visual Studio and it will hang for 20 seconds while it loads data. It won't let you store color schemes and you must spend 30 minutes tweaking your colors and fonts every time you want a change of scenery. In VIM you can set line spacing to zero to fit more lines of code on the screen. I get over 80 lines. Visual studio uses 2 pixels of spacing for every line and you can't adjust it!!! Less lines = more scrolling = less productivity = forced to use small fonts for more lines = eye strain.
VIM 的脚本是巨大的。您可以下载或创建数千种配色方案并立即更改颜色。尝试在 Microsoft Visual Studio 中更改字体或颜色,它会在加载数据时挂起 20 秒。它不会让你存储配色方案,每次你想要改变风景时,你都必须花 30 分钟来调整你的颜色和字体。在 VIM 中,您可以将行距设置为零以在屏幕上显示更多行代码。我得到超过 80 行。Visual Studio 为每行使用 2 个像素的间距,您无法调整它!!!更少的行 = 更多的滚动 = 更少的生产力 = 被迫使用小字体来显示更多的行 = 眼睛疲劳。
Split windows are opened in an instnat in VIM. It's usefull when you need to look at data in one section of the code that's far from the place you are typing (or in a different file). You don't have to spend time resizing windows, or worry about GUI windows overlapping each other and falling behind each other. Un-related code windows can be opened in tabs as to not take up screen space, but allow quick switching.
拆分窗口在 VIM 的 instnat 中打开。当您需要查看远离键入位置(或其他文件)的代码部分中的数据时,它非常有用。您不必花时间调整窗口大小,也不必担心 GUI 窗口彼此重叠并落后于彼此。不相关的代码窗口可以在标签中打开,不占用屏幕空间,但允许快速切换。
VIM as an IDE: http://www.youtube.com/watch?v=MQy2rVOf-z0&feature=fvwrelVIM the revenge: http://www.youtube.com/watch?v=lQNFfhC4QI8
VIM 作为 IDE:http: //www.youtube.com/watch?v=MQy2rVOf-z0&feature =fvwrel VIM 复仇:http: //www.youtube.com/watch?v=lQNFfhC4QI8
回答by Jim Ferrans
I've used vi for years to edit code in a variety of languages, and really love it. But I've found IDEs like Eclipse to be even nicer for Java development, and now I tend to work in Eclipse almost entirely. I drop out to use vi from time to time for a few specialized activities like bulk-inserting copyright notices, mainly those dealing with certain kinds of rote edits that aren't well automated in Eclipse. I also have my Windows .java file type mapped to vi for when I just want to look at a source file without waiting for Eclipse to open up.
我多年来一直使用 vi 编辑各种语言的代码,并且非常喜欢它。但是我发现像 Eclipse 这样的 IDE 更适合 Java 开发,现在我几乎完全在 Eclipse 中工作。我不时退出使用 vi 进行一些专门的活动,例如批量插入版权声明,主要是处理某些在 Eclipse 中不能很好自动化的死记硬背编辑。当我只想查看源文件而不等待 Eclipse 打开时,我也将我的 Windows .java 文件类型映射到 vi。
Some of the attractive features in Eclipse are:
Eclipse 中的一些吸引人的特性是:
- method name completion
- error highlighting
- pop-up javadoc comments
- refactoring
- 方法名补全
- 错误突出显示
- 弹出的 javadoc 注释
- 重构
I do find it a lot more efficient than vi in general, so you should try it out and see if it that holds true for you too.
我确实发现它总体上比 vi 高效得多,因此您应该尝试一下,看看它是否也适用于您。
回答by J?rgen Fogh
I remember reading somewhere about a study which showed that people perceivedkeyboard shortcuts as more efficient than mousing, when in fact it wasn't always.
我记得在某处读到过一项研究,该研究表明人们认为键盘快捷键比鼠标更有效,但实际上并非总是如此。
Another psychological effect is that we attach value to things which are expensive, i.e. since Emacs is harder to learn it mustbe better in some way.
另一个心理影响是我们重视昂贵的东西,即由于 Emacs 更难学,所以它必须在某些方面更好。
I think those effects could explain a lot of the extreme affection some people have for Emacs/Vi.
我认为这些影响可以解释一些人对 Emacs/Vi 的极度喜爱。
However, in the case of Eclipse, I find it can be very slow and even crash occasionally, but that is not a case against IDEs in general.
但是,在 Eclipse 的情况下,我发现它可能会非常慢,甚至偶尔会崩溃,但这对于 IDE 来说通常不是这样。
I use both Eclipse, VS and Emacs regularly. I would use TextMate too, but I don't have a mac anymore. It depends on what I am doing, more specifically, what system best supports my language and tools.
我经常使用 Eclipse、VS 和 Emacs。我也会使用 TextMate,但我没有 Mac 了。这取决于我在做什么,更具体地说,什么系统最能支持我的语言和工具。
I know people who spend considerably more time programming their editor, than they spend doing something useful. Some of them even admit themselves that they only do it for the challenge. Other people often claim that Emacs/Vi can do much more than IDEs, because they are scriptable. Well, most IDEs (including Eclipse) can also be scripted. In that sense almost all editors are equivalent (though, I admit, some editors are more easily scripted than others).
我知道有些人花在编辑器编程上的时间比花在做一些有用的事情上的时间要多得多。他们中的一些人甚至承认自己只是为了挑战而这样做。其他人经常声称 Emacs/Vi 可以做的比 IDE 多得多,因为它们是可编写脚本的。嗯,大多数 IDE(包括 Eclipse)也可以编写脚本。从这个意义上说,几乎所有编辑器都是等效的(尽管我承认,有些编辑器比其他编辑器更容易编写脚本)。
If you like IDEs, my advice is to keep using one. There is no One True Editor.
如果您喜欢 IDE,我的建议是继续使用 IDE。没有一个真正的编辑器。
EDIT:
编辑:
Thisseems to be the article Nick Bastin is referring to. I agree that it is far from a definitive source. However, I still think my point about perceived and real productivity not being the same thing still holds.
这似乎是 Nick Bastin 所指的文章。我同意它远非确定的来源。然而,我仍然认为我关于感知和实际生产力不是一回事的观点仍然成立。
回答by hiena
It depends on the languages.
这取决于语言。
For Java or .NET use an IDE (Eclipse,Netbeans,Visual Studio...).
对于 Java 或 .NET,请使用 IDE(Eclipse、Netbeans、Visual Studio...)。
For almost all the other languages(C,C++,ruby,python,haskell,lisp...) vi and emacs are better in my opinion.
对于几乎所有其他语言(C、C++、ruby、python、haskell、lisp...),我认为 vi 和 emacs 更好。
回答by Jon W
The efficiency provided from vim/emacs is mostly afforded by their heavy keyboard use. In these programs you can do most anything directly from the keyboard, rather than having to stop and use the mouse.
vim/emacs 提供的效率主要是由它们大量使用键盘提供的。在这些程序中,您可以直接通过键盘执行大部分操作,而不必停下来使用鼠标。