Vim/Emacs 比 GUI 文本编辑器提供了哪些具体的生产力提升? [英] What specific productivity gains do Vim/Emacs provide over GUI text editors?

查看:12
本文介绍了Vim/Emacs 比 GUI 文本编辑器提供了哪些具体的生产力提升?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这不是一个巨魔或火焰诱饵或类似的东西.几个月来,我一直在使用 Vim 作为我选择的控制台编辑器现在(用于在我的终端中编辑配置文件),但我认为我无法忍受编写 Web 应用程序的日常工作,我使用 GUI 文本编辑器(哪个不重要).

我觉得我的 GUI 文本编辑器可以完成我工作所需的一切.它具有不错的搜索/替换功能,并为两者提供自动完成历史记录.它具有语法高亮、行号、选项卡式界面、易于复制和粘贴等功能.我当前的编辑器唯一缺少的是正则表达式匹配,但有很多 GUI 文本编辑器可以进行正则表达式搜索/替换.

鉴于我刚才所说的,除了它安装在每台计算机上这一事实之外,Vim(甚至 Emacs)与 GUI 文本编辑器相比还有哪些生产力优势.我想要在 Vim/Emacs 上更好/更快的特定任务,或者现有 GUI 文本编辑器无法完成的任务.

解决方案

对于 Vim:

  • 与大多数编辑器相比,Vim 与其他工具(shell 命令、脚本、编译器、版本控制系统、ctags 等)的集成更好.即使是像 :.! 这样简单的东西,将命令的输出通过管道传输到缓冲区,在大多数 GUI 编辑器中都找不到.

  • 选项卡式界面不如 Vim/Emacs 提供的窗口化"界面好.您可以同时并排查看两个或多个文件.您在屏幕上看到的越多,您就越能腾出时间思考您的问题,而不是在脑海中记下变量名称和函数签名.

  • 不要低估 Vim 正则表达式的威力.有很多 Vim 特定的扩展来匹配特定的列、标记、光标位置、某些类别的字符(关键字、标识符)等.

  • 集成了 diffgrep(独立于平台,因此您无需在每次更换计算机时下载和学习新工具).

  • 视觉块模式(用于编辑列)是许多编辑器所缺乏的,但我不能没有.我让工作中的人感到震惊和敬畏,只使用它,在几个按键中进行一些编辑,否则有人会花 10 分钟手动完成.

  • 多个复制/粘贴寄存器.当你只有一个时,你最终会经历奇怪的扭曲以避免破坏剪贴板.你不应该这样做.

  • Vim 的撤销/重做系统是无与伦比的.键入内容、撤消、键入其他内容,您仍然可以返回您键入的第一件事,因为 Vim 使用撤消树而不是堆栈.在几乎所有其他程序中,在这种情况下,您键入的第一件事的历史记录都会丢失.

  • 在 Vim 中移动、复制、粘贴和删除文本非常快.这些命令很简单,只需一次按键,并且可以组合.把你小心、费力的鼠标高亮和 Ctrl-X 的所有时间加起来,然后用 da( 替换它们(删除一组匹配的括号和其中的所有内容).这样可以节省更多时间比你想象的要好

  • 小东西,比如 * 搜索光标下的单词,或 . 重复命令,或 %> 在打开和关闭括号之间反弹.太多了,无法一一列举.

  • 内置脚本语言以及强大的键映射和宏功能,因此可以以您需要的任何方式扩展编辑器.大量脚本已经编写并可供下载.

如果你仔细观察,你会发现即使是其他编辑器也有的功能,Vim 通常做得更好.所有的编辑器都有语法高亮显示,但 Vim 有一个语法文件,适用于几乎所有的文件格式,通常有很多配置选项,编写自己的很简单.许多编辑器可以处理不同的文件编码,但是 Vim 为您提供了非常具体且万无一失的设置文件编码和在它们之间进行转换的方法.与我当时遇到问题的其他编辑器相比,Vim 给我留下深刻印象的第一件事是它处理制表符/空格缩进选项和 Unix/DOS 换行符的完美程度.

其中许多要点同样适用于 Emacs(以不同但通常同样强大的方式).

This isn't meant as a troll or flamebait or anything like that. I've been using Vim as my console-editor of choice for a couple months now (for editing configuration files while in my terminal), but I don't think I could stand it for my normal, every day work of writing web applications, which I do with a GUI text editor (which one isn't important).

I feel like my GUI text editor can do everything I need for my work. It has a decent search/replace with auto-complete histories for both. It has syntax highlighting, line numbering, a tabbed interface, easy copying and pasting, etc. The only thing my current editor is missing is regular expression matching, but there are plenty of GUI text editors that will do regex search/replace.

Given what I just said, what productivity advantages does Vim (or even Emacs) have over a GUI text editor aside from that fact that it is installed on every computer. I'd like specific tasks that are better/faster on Vim/Emacs or that are just not possible with existing GUI text editors.

解决方案

For Vim:

  • Vim has better integration with other tools (shell commands, scripts, compilers, version control systems, ctags, etc.) than most editors. Even something simple like :.!, to pipe a command's output into a buffer, is something you won't find in most GUI editors.

  • A tabbed interface is not as nice as the "windowed" interface that Vim/Emacs give you. You can see two or more files at the same time side-by-side. The more you can see on-screen, the more you free your mind to think about your problem rather than doing mental bookkeeping of variable names and function signatures.

  • Don't underestimate the power of Vim regular expressions. There are a lot of Vim-specific extensions to match a specific column, a mark, the cursor position, certain classes of characters (keywords, identifiers) etc.

  • Integrated diff and grep (platform independent so you don't need to download and learn a new tool every time you change computers).

  • Visual block mode (to edit columns) is something many editors lack, but that I can't live without. I have shocked and awed people at work using just this, making some edit in a few keypresses that someone would've otherwise spent ten minutes doing manually.

  • Multiple copy/paste registers. When you only have one, you end up going through strange contortions to avoid clobbering the clipboard. You shouldn't have to.

  • Vim's undo/redo system is unbeatable. Type something, undo, type something else, and you can still get back the first thing you typed because Vim uses an undo tree rather than a stack. In almost every other program, the history of the first thing you typed is lost in this circumstance.

  • Moving around, copying, pasting, and deleting text is insanely fast in Vim. The commands are simple, single keypresses, and composable. Add up all the times you do a careful, laborious mouse highlight and Ctrl-X, then replace them all with a da( (delete a set of matching parens and everything in them). It saves more time than you'd think

  • The little things, like * to search for the word under the cursor, or . to repeat a command, or % to bounce between an opening and closing paren. Way too many of these to list.

  • Built-in scripting language and powerful key-mapping and macro ability so the editor can be extended in whatever ways you need. Tons of scripts already written and downloadable.

If you look closely enough, you'll find that even features that other editors also have, Vim often does better. All editors have syntax highlighting, but Vim has a syntax file for nearly every file format under the sun, often with lots of configuration options, and it's dirt-simple to write your own. Lots of editors handle different file encodings OK, but Vim gives you very specific and foolproof ways of setting file encodings and converting between them. The very first thing that impressed me about Vim is how perfectly it handles tab/space indentation options and Unix/DOS linebreaks compared to other editors that I had problems with at the time.

Many of these points apply equally well to Emacs (in different but usually equally-powerful ways).

这篇关于Vim/Emacs 比 GUI 文本编辑器提供了哪些具体的生产力提升?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆