My Own Personal Editor War
点 这里 查看更多
Emacs 相关推荐文章 或
最新 Emacs 圈的动态. 欢迎关注微信公众账号: Emacsist
一个行事认真的人, 都会以一种谨慎的态度去选择. 每个认真的程序员都会至少有一场发生在大脑斗兽场的编辑器之战. 不是纠结编辑器, 一起来认识下这些编辑器吧. 上纲上线了说, 来构筑下咱的世界观吧 :)
I’m a stickler for dev tools, in particular text editors, almost to a fault. Okay, definitely to a fault. Okay, probably well past the point where any reasonable person would call it a fault.
For a long time after Vim opened my eyes to the power of a Real Text Editor and the fun and effortless feeling of modal editing, I tried to do as much code and longform writing as possible in it, or at least some editor with a decent emulation of its keybindings. But at some point in the last several years there’s been an explosion of good editors, many of which fit that latter criteria. So I took the opportunity to explore a few of them and try to find one that would do away with Vim’s shortcomings while still giving me that sweet, sweet modal editing that I so crave.
Vim 打开了作者的编辑器情节, 嘿嘿, 这个任务原本也能交给 sublime 的, 不过作为大多数 linux 发行版的默认编辑器, 有时候 Vim 也是不得已之选.
What’s Wrong With Vim?
Why did I want to move away from Vim? It’s the original modal editor (well, not counting vi) and it has a hugely robust ecosystem and userbase that makes the solution to almost any problem a Google search away.
But it also has some limitations, baked in at a very low level, that grated on me more and more until I finally wanted to see if I could do better. Some of those limitations:
- Bluntly, Vim is Just a Text Editor and attempts to turn it into an IDEare doomed to kludginess at best and frustration and failure at worst as you tack on dozens of plugins in order to achieve what any IDE worth its salt would call basic functionality.
作者认为 Vim 基本功能太搓了, 为了把 Vim 当一个 IDE 来用, 需要费劲功夫配置很多包来实现一些其他编辑器的基本功能. 我认为 Emacs 虽然开始自带一些 el , 默认的功能也是偏弱的 :)
- Perhaps the situation in the above point would be okay if the dozens of plugins I alluded to had better cross-platform support. But due to circumstances beyond my control I have to use Windows at work, and time and time again while trying to set up a Vim plugin I’d see something to the effect of “Tested on OS X and Linux, seems to work on Windows, but YMMV” in its GitHub readme. Pile enough code with disclaimers like that on top of itself and it’s a recipe for disaster.
在作者看来 Vim 插件的跨平台似乎做得不够好? 我用得 Vim 不够深, 倒是没这个体会. Emacs 的跨平台问题主要在一些依赖外部工具比如 grep find ag 命令之类的地方, 很少. 另外也有一些开始用 elisp 实现一些 ag 命令等替代本来依赖外部命令的, 虽然实现的效率要低, 估计这方面 Emacs 是存在扩展语言优势的.
- I know, I know: it’s open source, fix it yourself, yadda yadda. But Vim plugins are mostly written in Vimscript, a wonky, frustrating, Vim-exclusive language that I really have no interest in learning.
这个是我之前有认识的, Vim 的扩展语言太搓了, 确实没啥动力去学习. elisp 作为函数式编程还是多少有动力甚至觉得好玩的
- At some point in my investigation of other editors, I got addicted to having a linter running alongside my editing in realtime. Since I code mostly in Python at work, a linter can catch a lot of errors before I run anything, which can save me a lot of time. But the only way to get the kind of asynchronous/multi-threaded process support that you need for real-time linting in Vim is to use an experimental fork that will probably never be merged into Vim proper or some kind of otherkludge which requires compiling an “external c helper application” and I bet works just great on Windows.
听起来 Vim 的异步和线程处理能力也不是原生支持的, 比较麻烦. 这个 Emacs 也不大擅长, 听说过俩异步处理 .el 算是有所补偿.
- Related to that last point: Vim dates from 1991, and looks it. It’s based on vi, which is from the late 1970s and ran only in a terminal. Vim has a “GUI” mode, but it’s little more than a glorified terminal: its rendering is strictly grid-based; it supports only one font at a time; and any “graphics” that you can get in it are actually just text, so even many of the most attractive Vim setups have rough edges and a feeling of being dated.
Vim 的假 GUI 跟 Emacs 还是很像的, 都不够 GUI , 不过 Emacs 确实有一些 GUI 能力比如能直接查看图片等. Vim 只支持一种字体稍微遗憾, Emacs 的富文本能力还是蛮强的, 支持各种字体以及超链接等.
- Like a lot of other people, I have my fingers crossed that Neovim will get off the ground, because I think it will solve a lot of these problems. But I want an editor I can use and enjoy now.
- The final nail in Vim’s coffin, as far as using it for heavier IDE-type coding, was trying out Sublime Text for a while.
Sublime Text’s main advantages over Vim, for me:
- Its cross-platform support is better.
- Its IDE-esque capabilities are better. In particular, I don’t think I’ve ever found a project management system that I like as much as ST’s, and its Goto Anything feature is really slick.
- It starts up faster than a Vim that’s sufficiently tricked out to be equally capable.
- It strikes a good balance between “just a text editor” and “fuckingEclipse”.
- It uses Python as an extension language.
- It’s much prettier than Vim. This is something that I’ve been led to believe I shouldn’t care about as a Coder, but I’m also a lifelong Mac user, so I do care. Sue me.
Like Vim, though, Sublime started to show cracks after a while. Unfortunately this happened after I already paid for it, but I got enough use out of it (and learned enough from it about what I will and won’t put up with in my tools) that I consider that money reasonably well spent. For the record, though, a list of my grievances:
哈哈哈哈, 不幸的是作者意识到 sublime 还不够合适他之前已经花钱购买 sublime 了(可能有些同学不知道, sublime 可以免费用, 不购买会出现一定频率的提示弹窗), 好可爱,
- The vi emulation plugin, “Vintage mode,” seems decent at first glance but after sustained use turns out to be pretty deficient: many commands are missing or behave incorrectly, and the plugin has had very few updates to fix them in the last couple years. (More on this later.) There’s an alternative third-party plugin that’s more complete, but it still has a brace of bugs and shortcomings that are frustrating to anyone used to actual Vim, particularly in the area of defining new keybindings. Basically, the vi emulation situation in Sublime is spotty at best.
Vim 毒还是很深的, 用 Sublime 了还不忘用 Vim 风格. 早些年的时候我都没听说过 evil 这种 Emacs 中的 Vim 风格实现.
- The cross-platform situation is better than Vim, but there are still some patchy bits of the preferences system that made sharing prefs in Dropbox between my work Windows machine and my home Mac a chore. In particular: the User preferences, where you’re supposed to make your personal configuration changes, are shared on all platforms, which is suboptimal. To get platform-specific settings, I had to configure them in a place I wasn’t supposed to, which of course caused problems elsewhere.
跨平台比 Vim 似乎要好, 看出来了, 作者是说还是没 Emacs 的跨平台做得好, 嘿嘿
- The developer is almost completely incommunicado. Bugs and feature requests are slow to be addressed if they’re addressed at all.
开放性确实差, 不开源嘛, 开源在插件体系的工具里还是蛮有生命力的
- Relatedly, documentation is often outdated or incomplete and shows no signs of being updated, so a community documentation project has arisen to fill in the gaps. This and the previous point are pretty unacceptable for a paid product, in my opinion. This review concurs, a little more frothily than this blog post. (NB: at least some of the quotes in the “Stupid, stupid docs” section have been excised from the unofficial docs, but I can corroborate that they were once there. Hell, I even submitted a pull request to remove the worst of them myself.)
以前没意识到, 说 Sublime 的文档差确实挺多. 不过作者似乎没注意到 API 文档更差, API 设计也差, 就那么几个接口, 文档还不全, 还好 Python 的自省能力不错, 当初我写 Sublime 扩展就是靠 Python 的能力, 官网的文档只能嘿嘿了.
I probably could have lived with these problems. Sublime has the nice asynchronous linting I crave and just the right amount of IDE features, and I encounter few enough bugs in my routine ST usage that my last two complaints were mostly ideological rather than practical. But still. There’s got to be something better, right?
Sublime 的异步和线程处理能力可以说源自 Python 确实突出; 当然编辑器本身的一些非 Python 的异步处理也还是不错的.
Well, spoiler alert: after years as a Vim user hearing about how it’s a ridiculous nonsense program that’s too big for its britches, I’m currently using Emacs and, on the whole, liking it more than I did Vim or ST when I got fed up with them. But because Emacs is not a text editor but a tiny universe, it took me four or five false starts before I finally found a way in that worked for me. I’ll describe it in a future post.
玩 Emacs 的经常是经历过好几次被折磨得没信心了, 然后又重来, 哈哈哈
原文时间: 2014-11-24 15:00
整理时间: 2015-04-12 00:27
本文由 Hick 整理，转载请保留以上信息;
The articles on this site come from Internet, thanks to all the original authors.
If anything about COPYRIGHT, or LEFT, please contact Emacsist at gmail dot com .