为什么选择 Emacs/Vim/Textmate? Xcode 还不够好吗?
你好,我主要从事 C++、Objective-C 编程。 我发现 Xcode 加上一个自动完成/宏插件(Completion Dictionary)就足够了。
然而,所有人似乎都对他们的纯文本编辑器赞不绝口。 我尝试了一下 Textmate; 喜欢它的简单性,但不喜欢它的文件/框架处理。
我在这里错过了什么吗? 或者,Vim 或 Emacs 的自动完成功能是否与 Xcode 一样好?
Hi I mostly do C++, Objective-C programming. And I found Xcode plus an auto completion/macro plugin (Completion Dictionary) quite adequate.
However, all people seem to praise over their pure text editors. I tried Textmate for a bit; liked its simplicity but dislike its files/framework handling.
Am I missing something here? Or, do Vim or Emacs have auto-completion as good as Xcode?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(21)
我不使用 vi 进行编码; 不过,如果可用的话,我会在编辑器中使用 vi 模拟。 当我在 IntelliJ 中进行 Java 编码时,我使用 IdeaVIM 插件,它在 IntelliJ 编辑器中为我提供了 vi 支持。 这意味着我几乎永远不需要将手指离开本排。 我使用键盘(h、j、k、l)进行导航,使用 yy、dd 等进行剪切/粘贴。当然,当我确实需要全功能 GUI 编辑器的强大功能时,vi 仿真并不妨碍我使用这些功能特征。
XCode 的编辑器中没有 vi 模拟,这让我抓狂。 看起来像是任何像样的 IDE 都应该具备的功能。
I don't use vi to do my coding; however, I do, when available, use vi emulation in my editors. When I am doing Java coding in IntelliJ I use the IdeaVIM plugin which gives me vi support in IntelliJ's editor. This means I almost never have to take my fingers off of home row. I navigate with the keyboard (h,j,k,l), cut/paste with yy, dd, etc. And of course when I do need the power of a full feature GUI editor vi emulation doesn't keep me from using those features.
It drives me nuts that XCode doesn't have vi emulation in its editor. Seems like functionality that any decent IDE should have.
TextMate 对我来说感觉更轻松。 我突然想到:
它对在文件和文件内的方法之间跳转有很大的支持。 想想 Quicksilver 的文件/方法。 打开文件进行编辑后,按 command-shift-t 打开一个浮动面板,列出文件中的所有方法。 开始输入内容,列表就会自动向下过滤。 选择您想要的方法并按回车键跳转到该方法。 Xcode 有类似的东西,但字符串匹配更字面化。
大量内置文本扩展。 输入触发器并点击选项卡将其展开。 例如,在新行中键入 m,然后按 Tab 键会为您创建一个方法。 然后,Tab 键会智能地跳转到插入文本的各个部分,以便您可以就地编辑它们。 这些节省了巨大的时间,简直太荒谬了。
对 Subversion 和 Git 的良好插件支持。 可能还有其他 VCS。
完成(如 Xcode)和历史记录。 TextMate 允许您对文件中存在的基本上任何文本进行制表符补全。 因此,一旦您键入变量名称或方法调用一次,您就可以使用 Tab 在同一文件中的任何位置自动完成它。
带有历史记录的智能过去板,漂亮的内置差异,主题支持,良好的键盘支持,在文件和跨项目中查找(使用正则表达式),可能还有更多我忘记的东西。
无论如何,这对我来说已经足够了。
TextMate just feels lighter to me. Off the top of my head:
It has great support for jumping between files and methods within files. Think Quicksilver for files/methods. With a file open for editing, hit command-shift-t to bring up a floating panel listing all the methods in the file. Start typing and the list filters itself down. Select the method you want and hit return to jump to it. Xcode has something like this but the sting matching is more literal.
Lots of built in text expansion. Type a trigger and hit tab to have it expanded. For example, on a new line typing m and then hitting tab creates a method for you. The tab key then intelligently jumps to the various parts of the inserted text so that you can edit them in place. These are such a huge timesaver it's ridiculous.
Nice plugin support for Subversion and Git. Probably other VCSs too.
Completions (like Xcode) and history. TextMate allows you to tab-complete basically any text that exists in the file. So once you type a variable name or method call once, you can use tab to auto-complete it anywhere in that same file.
Smart past board with history, nice built in diffs, theme support, good keyboard support, find in files and across projects (with RegEx) and probably more that I'm forgetting.
Anyway, that's enough from me.
就我个人而言,我喜欢 TextMate,因为它实际上是一个非常轻量级的解决方案。 当然,我没有深入使用 Vim 或 Emacs(我喜欢我的 GUI)...尽管我非常喜欢基于 Control 的光标导航(Control-A 是行首,Control-E 是行尾,Control- F 和 Control-B 是前进和后退,等等)。 因此,在 Xcode 和 TextMate 之间,我使用 Xcode 进行大部分认真的开发,但如果我只需要快速编辑源文件,我可以在 Xcode 完成启动之前启动并编码(这有助于 TextMate 记住之前打开了哪些文件)并恢复它们)。 因此,对于一些轻量级的文本编辑,TextMate 是我的选择。
除此之外,TextMate 的插件支持令人惊叹; 它为 Xcode 不提供的许多不同事物(shell 脚本、CSS、SQL、LaTeX 等)提供全面支持(语法着色、构建和运行等)。 当我需要用 Java 快速复习一个程序或调整网页时,使用 Vim 然后从终端构建要容易得多。
我对 TextMate 的唯一抱怨是控制台是只读的,因此我无法构建任何交互式内容。 事实上,它似乎不支持纯 C 文件中的 C99 关键字(for 循环和布尔值)。
Personally, I love TextMate, because it's actually a really lightweight solution. Granted, I have not used Vim or Emacs in depth (I like my GUIs)...although I do thoroughly enjoy the Control-based cursor navigation (Control-A is beginning of line, Control-E is end of line, Control-F and Control-B are forward and backward, etc). So between Xcode and TextMate, I use Xcode for most of my serious development, but if I just need to quickly edit a source file I can be up and coding before Xcode even finishes launching (it helps that TextMate can remember which files were previously opened and restore them). So for some lightweight text editing, TextMate is my choice.
Above that, TextMate's plug-in support is amazing; it provides full support (syntax coloring, building & running, etc.) for so many different things (shell scripts, CSS, SQL, LaTeX, and much more) that Xcode doesn't provide. When I need to brush up a quick program in Java or tweak a webpage, it's a lot easier then using Vim and then building from the Terminal.
My only complaint with TextMate is that the console is read-only, so I can't build anything interactive. That, and the fact that it doesn't seem to support C99 keywords (for loops and booleans) in a plain-C file.
我是一名长期 Vim 用户,并且发现我真的很喜欢在打开 Vim 模拟的情况下进行 Komodo 编辑。 因此,我得到了 vim 键绑定的所有便利(我已经习惯了,我最近生成的 MS Word 文档中至少有三个“:w”)加上良好实现的代码完成C++、Python、javascript 等。
我不使用 XCode,因为我不太开发 OS X 特定的应用程序,因此 OS X 框架集成的好处不足以抵消没有 vim key 的成本绑定以及苹果公司采取的“要么按照我们的方式做,要么根本不做”的开发方法。
I am a long time vim user, and find that I really like Komodo edit with the Vim emulation turned on. Thus, I get all of convenience of the vim key bindings (to which I have become so accustomed that a recent MS Word document that I recently produced had no less than three ":w"s in it) plus the well implemented code completion for C++, Python, javascript, etc.
I don't use XCode because I don't develop OS X specific applications very much and so the benefit of the OS X framework integration isn't large enough to outweigh the cost of not having vim key bindings and the "do it our way or not at all" approach that Apple takes toward development.
Xcode 更像是一个 IDE,而 emacs 和 vi 用于纯文本(尽管它们有大量扩展)。 如果您使用的是较旧的系统或通过 SSH,则这是更好的选择。 此外,它们几乎存在于每台基于 UNIX 的计算机上,而 XCode 是 Apple 专有软件。
Xcode is more of an IDE, whereas emacs and vi are for pure text (though they have massive extensions to them). This is preferable if you're on an older system or over an SSH. In addition, they're pretty much on every UNIX based computer, whereas XCode is proprietary Apple software.
您可能会看一下我关于该主题的文章 为什么选择 Emacs? 。 虽然它或多或少以 Emacs 为中心,但其中提出的一些观点也适用于 vim 和 TextMate。
You might have a look at my essay on the subject Why Emacs?. While it's more or less Emacs-centric some of the points made in it would apply to vim and TextMate as well.
我很久以前就尝试过 vim,但由于某种原因“我没明白”。 然后,在多年来尝试其他编辑器之后,我发现似乎没有一个编辑器可以做我想做的事情。 在向朋友表达了我的沮丧之后,他建议我尝试一下 vim……我很高兴我又看了一眼,因为这是我不知道如何问的问题的答案! 从那时起我就开始使用 Vim/MacVim...
这是我的配置:
https://github.com/RandyMcMillan/QuickVim
我也使用 Xcode,因为有代码很好完成。
XVim 非常适合那些想要在 Xcode 编辑器中获得 modal/vim 感觉的人:
https://github.com/JugglerShu/XVim
但是当谈到我的日常编辑时,Vim 胜出每次。 这就是我拥有 QuickVim 存储库的原因,以便我可以随时随地快速重现我的环境。
我有一个 TextMate 等编辑器的许可证列表。但我很可能永远不会使用它们,因为我可以免费使用 vim 并根据我的具体规格对其进行自定义。
I tried vim a long time ago and for one reason or another "I didn't get it". Then after trying other editors over the years I reached a point where no editor seemed to do what I wanted it to do. After voicing my frustration to a friend he recommended that I try vim....and I am so glad that I took another look because it was the answer to a question that I didn't know how to ask! I have used Vim/MacVim ever since...
here my configuration:
https://github.com/RandyMcMillan/QuickVim
I use Xcode as well because it is nice to have code completion.
XVim is good for people that want a modal/vim feel in the Xcode editor:
https://github.com/JugglerShu/XVim
But when it comes to my day to day editing Vim wins every time. That is why I have the QuickVim repo is so that I can quickly reproduce my environment anytime/anywhere.
I have a list of licenses for editors like TextMate, etc..but it is likely that I won't ever use them since I can use vim for free and customize it to my exact specifications.
这里是 Vim 的重度用户。 我通常发现 Vi/Vim 的文本操作能力远远优于传统编辑器,传统编辑器缺少以下功能:
这些只是 Vim 轻松实现
Objective-C 的 XCode 文本编辑的几个示例。 我倾向于在 IDE 上安装 Vim 插件,以获得两全其美的效果 - 原生构建/UI 组件支持。
顺便。 Mac 上的许多本机 (Coacoa) 文本字段都支持 Emac 键盘绑定(例如,使用 CTRL-A 转到行首)。 包括您用于在 stackoverflow 上输入答案的那个:D
XVim 可与 XCode 配合使用。 IdeaVim 用于 应用程序代码
Heavy Vim user here. I generally find the text manipulation capability of Vi/Vim far superior than traditional editors which lack things like:
These are just a few examples that Vim has XCode text editing beat hands down
For Objective-C. I tend to install a Vim plugin on the IDE to get the best of both worlds - native build / UI components support.
Incidentally. Emac keyboard bindings (e.g. CTRL-A to go to top of line) are supported in a lot of native (Coacoa) text fields on Mac. Including the one you're using for typing answers on stackoverflow :D
XVim works with XCode. IdeaVim for AppCode
儿子,拉张椅子来,让我谈谈这个。
早在 Xcode 出现之前,就有了 VIM 和 Emacs。 我知道这很难想象,但这是事实。
许多人习惯了 VIM/Emacs,从而继续使用它。
Emacs 是高度可定制的,并提供几乎所有你能想象到的东西(包括内置的收缩和河内塔)。 您可以轻松地从 Emacs 调用编译器,并根据需要创建您自己的扩展。
VIM 拥有令人难以置信的正则表达式引擎(Emacs 也有)并且非常方便,因为 (VI) 几乎随每个 Unix 操作系统一起提供,如果您没有方向键,它的工作效果会非常好(是的,是的,真正的老派)。 人们非常擅长使用按键来移动文档,而无需使用鼠标。
Emacs 也是如此,但对我来说,我发现 VIM 上的光标移动更容易。
文本编辑器之战与 Mac 与 PC 之战一样,都充满了宗教狂热,答案是选择最适合您的。 如果您喜欢 Xcode,那就太好了,请继续使用它,但如果您被迫在 PC 或 Linux 机器上工作,祝您好运。 就我个人而言,我使用 Emacs 来编码,使用 VIM 来操作文本,使用 Firefox 来查看 lolcats。
Pull up a chair son, let me speak on this.
Well before the days of Xcode, there was VIM and Emacs. I know it's hard to imagine, but it's true.
Many people got accustomed to VIM/Emacs, and thus continue to use it.
Emacs is extremely customizable, and offers pretty much everything you can imagine (including a built in shrink and the towers of hanoi). You can easily call compilers from Emacs, and create your own extensions as needed.
VIM has incredible regex engine (Emacs does as well) and is very handy because (VI) comes with pretty much every Unix OS, and works fantastically if you don't have arrow keys (yeah yeah, real old school). People are very good with using keys to move around documents, without having to use the mouse.
The same is true with Emacs as well, but for me, I find cursor motion much easier on VIM.
The text editor war is fueled with as much religious zealotry as the Mac vs PC war, and the answer is pick the best that works for you. If you like Xcode, great, continue to use it, however good luck if you're ever forced to work on a PC or Linux machine. Personally, I use Emacs to code, VIM to manipulate text and Firefox to look at lolcats.
我真的不明白为什么当人们谈论文本编辑器时 emacs 会受到支持。 根据我的经验,它比 vi 更像 eclipse(或其他平台/IDE 之一),因为它是一个环境,而它恰好擅长文本编辑。
作为一个 IDE,emacs 具有版本控制、实时编译、拼写检查、自动完成、调试、代码浏览等功能,适用于各种 SDK。 对于您的其余计算需求,它是电子邮件/新闻/网络/irc/twitter/xmmp 客户端、日历、管理器、计算器、终端仿真器、远程编辑、电子表格、游戏等。
在 Dijkstra 之后:“Emacs 不是与天文学相比,文本编辑更多的是关于望远镜”
I really don't understand why emacs props up when people talk about text editors. In my experience it's more like eclipse (or one of those other platforms/IDEs) than vi because it is an environment, which happens to be good at text editing.
As an IDE emacs features version control, live compilation, spell checking, auto completion, debugging, code browsing and lots more for a wide variety of SDKs. For the rest of your computing needs it's an email/news/web/irc/twitter/xmmp client, calendar, organizer, calculator, terminal emulator, remote editing, speadsheets, games etc. etc. etc.
After Dijkstra: "Emacs is no more about text editing than astronomy is about telescopes"
您错过的是 Emacs 和 Vim 实际上是 IDE。
What you are missing is that Emacs and Vim are actually IDEs.
vi 在 UNIX 系统上无处不在,Emacs 也几乎如此。 AFAIK,Xcode 位于一个平台上。
拥有强大的 IDE 是一件很棒的事情,但每个人都应该掌握一些技能,以使其在可能进入的任何平台上都能正常运行。
vi is ubiquitous on UNIX systems, and Emacs almost so. AFAIK, Xcode is on one platform.
Having a powerhouse IDE is a great thing, but everyone should have a smattering of skill to keep them functional on any platform they might be dropped into.
这一切都取决于您的喜好。
有些人喜欢使用轻量级文本编辑器,例如 (g)vim、emacs、pico 等。
其他人喜欢使用 MS Visual Studio、Eclipse、Xcode 等 IDE。
只要您的环境与文本编辑技术兼容,一切都取决于您。
顺便说一句,我喜欢使用 Eclipse 和 vim,因为它们是我用来学习编程的东西;)
It's all up to your preference.
Some people like to work with lightweight texteditors like (g)vim, emacs, pico, etc.
Others like to work with IDEs like MS Visual Studio, Eclipse, Xcode.
As long as your environment is compatible with the text editing technology, it's all up to you.
By the way, I like working with Eclipse and vim because they are what I used to learn programming ;)
您似乎认为人们喜欢 Emacs/Vim 的主要原因是为了代码补全。 人们喜欢 Emacs/Vim,因为它们都是为编辑文本而生的。 您拥有其他编辑者所没有的控制权和选项。 一旦您真正擅长使用这些程序之一,您就会希望这些按键绑定/命令随处可用。 宏、正则表达式、通过搜索/单词/段落/函数移动、与版本控制交互、复杂的撤消/重做和复制/粘贴功能以及扩展选项只是这些编辑器做得非常好的事情中的一小部分。
代码完成只是可以使编程编写变得更容易的众多事情之一。 Emacs/Vim 可以处理所有这些(本地或通过扩展)。
The main reason you seem to think people like Emacs/Vim is for code completion. People like Emacs/Vim cause they are both MADE for editing text. You have control and options available to you that other editors just don't have. Once you get REALLY good at using one of these programs you want these key bindings / commands available everywhere. Macros, regular expressions, moving around by search/word/paragraph/function, interfacing with version control, complicated undo/redo and copy/paste functions and extension options are just a FEW of the things that these editors do really really well.
Code completion is just one of MANY things that can make writing programming easier. Emacs/Vim can handle ALL of them (natively or by exntensions).
不,不是真的。 这确实是一个偏好问题。 我喜欢在 Visual Studio 6 中工作,但现在较新的版本太臃肿了。 因此,如果我可以在 VS 之外做一些事情,我通常无需打开整个 IDE 框即可完成。
在 Windows 上我喜欢 notepad2 和 gvim。 我已经将 vim 定制到完全适合我的需求,所以我不必考虑什么和在哪里。
但是,值得一提的是(您也可以通过阅读这些类似的帖子自己弄清楚)很多用户使用 vim/emacs/... 因为听说它是最好的/很酷的因素/实际可用性。 因此,如果它不适合您,请不要使用它。 没有人会因此而以错误的方式看待你。
No, not really. It's a matter of preference really. I liked working in Visual Studio 6, but nowadays the newer versions are just too bloated. So if I can do something outside VS I usually do it without opening the whole IDE box.
On windows I like notepad2 and gvim. I've customized vim to the point where it suits my needs perfectly, so I don't have to think about what and where.
But, it's good to mention that (you could also figure that out by yourself by reading these kinda posts) a lot of users uses vim/emacs/... 'cause of the heard-its-the-best/cool-factor/actual-usability. So if it doesn't suit you, don't use it. Nobody's gonna look you the wrong way cause of that.
对我来说,两个最重要的功能是:
Emacs 键绑定,因为这是我的手指兼容的。
开源,因为它提供了自由。 与一个平台绑定是令人厌恶的。
这些天我主要使用 Eclipse 进行编程(设置为 Emacs 键绑定),使用 FSF Emacs 阅读邮件,偶尔使用一些 LaTeX。
For me most the two most important features are:
Emacs key bindings, as that is what my fingers are compatible to.
Open-source, for the freedom it provides. Being tied to one platform is anathema.
These days I mostly use Eclipse for programming (set to Emacs keybindings) and FSF Emacs for reading mail and some occasional LaTeX.
我个人很喜欢 emacs。 我使用过 vim 和一些 IDE。 Vim 和 emacs 都有很棒的社区,人们愿意为几乎任何语言编写功能。 我不知道有任何 IDE 支持 Haskell。 这完全取决于什么对你来说很重要。 两者都有扩展语言,但在我看来,emacs lisp 是两者中更好的一个。 忽略鼠标的能力也是我最喜欢的。 许多 IDE 还具有 emacs 和 vim 兼容模式或扩展。 他们都投入了大量的时间,但都是值得的。 迟早,您会选择适合您的 vim/emacs/IDE,然后坚持使用它来提高您的技能。
I personally love emacs. I've used vim and a handful of IDEs. Vim and emacs both have great communities where people are willing to code up features for just about any language. I don't know of any IDEs that, say, support Haskell. It all depends on what's important to you. Both have extension languages, though IMO, emacs lisp is the better of the two. The ability to ignore the mouse is the main thing I like as well. So many IDEs also feature emacs and vim compatibilty modes or extensions. They both have a large time investment, but both are worth it. Sooner or later, you will choose which suits you, vim/emacs/IDE, and then stick to improving your skills with it.
当你使用 Emacs 时,你可以安装 Cedet 或 Autocomplete 包来对某些语言使用名称补全(C++ 很漂亮)很好,虽然仍然不支持 Obj-C),此外还有丰富的编辑器功能
When you are using Emacs, you can install Cedet or Autocomplete package to use name completion for some languages (C++ is pretty good, while Obj-C is still not supported), in addition to rich editor functionality
emacs 很强大。 我将 emacs 与 vimpluse.el 一起使用,这样我就可以将 vim 键绑定与所有 emacs 功能一起使用。
emacs is powerful. I use emacs with vimpluse.el so that I can use the vim key bindings with all the emacs features.
我主要使用 Vim 作为输入模型。 一旦您精通输入模型,回到被迫使用鼠标的编辑器会感觉很笨拙,并且最终(至少对我来说)令人恼火。 输入“ci”来更改两个单引号之间的所有文本,然后将手从主行上移开,用鼠标查找并选择文本,最后点击“删除”,这样会更有效。
我只短暂使用过 Emacs,虽然我更喜欢 Vim,但我很嫉妒它的一些功能。 但我最终选择了 Vim,因为我发现 Emacs 使用的和弦输入模型会给我的手指带来不必要的压力。
I use Vim mostly for the input model. Once you have become proficient in the input model, going back to an editor where you are forced to use a mouse feels clumsy and ultimately (at least to me) irritating. It is a lot more efficient to type "ci'" to alter all the text between two single quotes, then taking your hands off of the home row, finding and selecting the text with the mouse and finally hitting 'delete'.
I have only used Emacs briefly and while I prefer Vim, I am jealous of some of its features. But I ultimately went with Vim because I find the chord-input model that Emacs uses to put unnecessary strain on my fingers.
我有 Xcode 和 TextMate,但我不使用它们,尽管我知道它们非常强大。 相反,我使用 Vim(如果您愿意,也可以使用 MacVim)。 为什么 ?
因为它轻量、快速、令人上瘾、强大、可定制......
我可以这样持续很长一段时间,但最重要的是我可以用 Vim 做我想做的一切。
无论您使用哪种编辑器,最好的编辑器都是您(几乎)完美掌握的编辑器。
I have Xcode and TextMate and I don't use them although I know they can be very powerful. Instead I use Vim (or MacVim if you prefer). Why ?
Because it's light, fast, addictive, powerful, customizable...
I could go on like this for a long time but the most important thing is that I can do all I want with Vim.
Whatever the editor you use, the best editor is the one you master (almost) perfectly.