# 文本编辑器

文本编辑器是一种用于创建和修改纯文本文件的程序，纯文本文件即表示字符而不含文档级格式、字体或版面的文件。它们与字处理器不同，后者生成结构化的、视觉上经过排版的文件。<sup>[1](https://notepadonlinefree.com/blog/online-text-editor-vs-word-processor)</sup>

| 关键事实 | 详情 |
|---|---|
| 最早的编辑器 | QED于1965年发布；其原始版本由一人设计、编写并调试，用时不到一周，占用不到4000字的可重入代码。<sup>[2](https://ar5iv.labs.arxiv.org/html/2008.06030)</sup><sup> • </sup><sup>[3](http://bwl-website.s3-website.us-east-2.amazonaws.com/04-OnlineEditor/04-OnlineEditor.pdf)</sup> |
| 缓冲区结构 | 间隙缓冲区（Emacs）、绳索结构（Sublime Text）、片段表（VS Code、Monaco）；在100 MB文件上的中位插入延迟分别为14.2毫秒、1.8毫秒和1.1毫秒。<sup>[4](https://johal.in/editing-software-process-that-brought-deep-dive)</sup> |
| 市场份额 | 据Stack Overflow开发者调查，2015年推出的VS Code被超过70%的受访者使用。<sup>[5](https://monovm.com/blog/best-text-editors/)</sup> |
| 速度差异 | Vim和Helix启动约需0.17秒；在一项独立测试中，VS Code冷启动需5.5至6秒，空闲内存约占1.5 GB。<sup>[6](https://www.makeuseof.com/ranked-fastest-code-editors-quickest-isnt-talking/)</sup> |
| 大文件 | VS Code将超过20 MB或30万行的文件视为大文件，并设定50 MB的模型同步上限。<sup>[7](https://github.com/microsoft/vscode/blob/master/src/vs/editor/common/model/textModel.ts)</sup> |
| IDE桥梁 | 语言服务器协议通过UTF-8编码的JSON-RPC，为任何编辑器提供自动补全、跳转到定义、悬停文档和错误高亮功能。<sup>[8](https://github.com/microsoft/language-server-protocol/blob/gh-pages/_specifications/lsp/3.18/specification.md)</sup><sup> • </sup><sup>[5](https://monovm.com/blog/best-text-editors/)</sup> |
| 近期变化 | Atom于2022年12月被GitHub归档；Zed于2026年达到1.0版本，支持并行AI代理和代理客户端协议。<sup>[5](https://monovm.com/blog/best-text-editors/)</sup><sup> • </sup><sup>[9](https://zed.dev/blog/zed-1-0)</sup> |

## 文本编辑器是什么

与字处理器的核心区别在于范围。文本编辑器专注于快速、简单地创建和编辑文本；字处理器则旨在生成带有字体、样式和版面的结构化、视觉化排版文件。<sup>[1](https://notepadonlinefree.com/blog/online-text-editor-vs-word-processor)</sup>

各类工具的边界是模糊的。代码编辑器是带有语法高亮等编程专用功能的文本编辑器；IDE（集成开发环境）则像是加强版的代码编辑器，具备代码编辑器的全部功能外加额外工具。<sup>[10](https://blog.jetbrains.com/webstorm/2024/03/ides-vs-code-editors/)</sup> IDE通常集成编译和调试工具，而代码编辑器可以打开和修改文件，并可能依赖扩展来完成构建和评估；文本编辑器可能开箱时功能不完整，但开发者可以对其进行改造，使其表现得像IDE。<sup>[11](https://www.tiny.cloud/blog/text-editor-vs-ide-vs-code-editor/)</sup>

## 历史

**行编辑器。** 最早的初级文本编辑器QED于1965年发布。<sup>[2](https://ar5iv.labs.arxiv.org/html/2008.06030)</sup> QED采用分页方案，将大部分文本保留在主存之外，因此大多数编辑操作——即使面对5万或10万字符的文件——计算时间也不到十分之一秒。<sup>[3](http://bwl-website.s3-website.us-east-2.amazonaws.com/04-OnlineEditor/04-OnlineEditor.pdf)</sup> 据George Coulouris所述，Vi主要由[Bill Joy](https://www.edgepedia.org/zh/bill-joy)在加州大学伯克利分校完成，它基于或至少受启发于伦敦玛丽女王学院开发的em编辑器，将ed的命令集适配到全屏显示上。<sup>[12](https://www.bell-labs.com/usr/dmr/www/qed.html)</sup>

**无模态编辑。** 20世纪70年代，[Larry Tesler](https://www.edgepedia.org/zh/larry-tesler)将模态的Bravo编辑器改造为无模态的Gypsy编辑器，1983年Poller和Garter展示了无模态方法的高效性。<sup>[2](https://ar5iv.labs.arxiv.org/html/2008.06030)</sup> ACM的Timelines系列收录了Tesler关于无模态文本编辑和剪切/复制/粘贴的第一人称叙述，将设计史呈现为不同视角和不同解读的交汇。<sup>[13](https://dl.acm.org/doi/10.1145/2212877.2212896)</sup>

**可编程编辑器。** [Eric S. Raymond](https://www.edgepedia.org/zh/eric-s-raymond)将Emacs描述为最强大的程序员编辑器——一个庞大的、功能丰富的程序，内含完整的编程语言[Emacs Lisp](https://www.edgepedia.org/zh/emacs-lisp)，用于编写任意强大的编辑功能，能够编辑多个文件，每个文件各有一个独立的缓冲区。<sup>[14](http://www.catb.org/%7Eesr/writings/taoup/html/ch13s02.html)</sup> Emacs还提供用于直接输入命令的命令行，这很可能启发了现代编辑器中的命令面板。<sup>[2](https://ar5iv.labs.arxiv.org/html/2008.06030)</sup>

## 编辑器如何工作

编辑器将正在编辑的文件存放在缓冲区中，这是一种为频繁插入和删除而优化的内存结构。在Emacs家族中，缓冲区是一个包含待编辑文本的Lisp对象；可以同时存在多个缓冲区，但恰好有一个是当前缓冲区，编辑命令作用于其上，每个缓冲区都有一个称为“点”的默认插入位置。<sup>[15](https://www.xemacs.org/Documentation/21.5/html/lispref_38.html)</sup><sup> • </sup><sup>[16](https://www.xemacs.org/Documentation/21.5/html/internals_24.html)</sup>

**间隙缓冲区。** 缓冲区间隙技术将文本存储为两段连续的字符序列，二者之间有一个可移动的间隙；编辑时先将间隙移动到要修改的位置，然后通过改变指针来插入或删除。该方法最早由TECO使用，将整个缓冲区视为单一对象。<sup>[17](https://web.mit.edu/~yandros/doc/craft-text-editing/Chapter-6.html)</sup> 其内存开销极小：一个固定大小的头部加上每字符一字节，一个示例缓冲区为9,008字节，而采用逐行头部和碎片化的链式行实现则为11,858字节。<sup>[17](https://web.mit.edu/~yandros/doc/craft-text-editing/Chapter-6.html)</sup> 该方案内存开销低，不过当大段文本需要在相距较远的编辑点之间搬移时，可能会出现相对较长的停顿。<sup>[17](https://web.mit.edu/~yandros/doc/craft-text-editing/Chapter-6.html)</sup>

**绳索结构与片段表。** 在一台2023年的[MacBook Pro](https://www.edgepedia.org/zh/macbook-pro)（M2 Pro，32 GB内存）上对100 MB文件执行10万次随机编辑的基准测试发现，间隙缓冲区的中位插入延迟为14.2毫秒，AVL绳索结构为1.8毫秒，片段表为1.1毫秒。片段表保留一个不可变的原始缓冲区加上一个仅追加的添加缓冲区，配有一个有序的片段列表，因此插入或删除时不会移动任何现有数据；VS Code和Monaco在生产中使用它，[Sublime Text](https://www.edgepedia.org/zh/sublime-text)使用绳索结构，Emacs使用间隙缓冲区。每字符的内存开销为：间隙缓冲区0字节，绳索结构的节点指针48字节，片段表每个片段条目约16字节；间隙缓冲区在光标跳转时性能下降，因为移动间隙的代价为O(gap_size)。<sup>[4](https://johal.in/editing-software-process-that-brought-deep-dive)</sup>

编辑器还施加了明确的大小限制。VS Code的文本模型设定50 MB的模型同步上限，将超过20 MB或30万行的文件视为大文件，并定义了2.56亿字符的堆操作阈值，通常对应超过512 MB的内存使用。<sup>[7](https://github.com/microsoft/vscode/blob/master/src/vs/editor/common/model/textModel.ts)</sup>

## 交互范式

**模态与无模态。** Vi采用模态方式：插入模式下击键修改文档，命令模式下击键被解释为命令。<sup>[2](https://ar5iv.labs.arxiv.org/html/2008.06030)</sup> Vim、Neovim和Helix等模态编辑器为输入文本和执行命令使用不同的模式，学习曲线陡峭，但一旦掌握效率很高；大多数活跃的Vim插件开发已转移到Neovim。<sup>[5](https://monovm.com/blog/best-text-editors/)</sup> 击键经济性是具体的：vi序列2wd2w3wPd3w6bep，共15个字符，将“The quick brown fox jumps over the lazy dog.”转换为“The quick lazy dog jumps over the brown fox.”<sup>[2](https://ar5iv.labs.arxiv.org/html/2008.06030)</sup> Kakoune采用类似vi的模态方式，但将顺序颠倒为“对象+动词”，而vi使用“动词+对象”。<sup>[2](https://ar5iv.labs.arxiv.org/html/2008.06030)</sup>

**研究显示了什么。** 在一项针对有经验用户的对照研究中，受试者根据标注过的打印稿执行固定编辑任务，vi组受试者在最终文件中留下的未纠正错误少于Emacs组，且vi组出现的模式错误很少，并能迅速纠正这些少量错误。Emacs组往往耗时更长，不过时间差异可能源于打字速度的差异。作者得出结论：对于固定编辑任务，模态编辑可能更可取，而无模态编辑在自由创作方面可能具有优势，理想的编辑器设计应结合模态和无模态特性。<sup>[18](https://doi.org/10.1145/800045.801603)</sup> 许多现代编辑器默认无模态并包含命令面板，这可能受到了Emacs命令行的影响。<sup>[2](https://ar5iv.labs.arxiv.org/html/2008.06030)</sup>

## 数据一览

**市场份额。** Stack Overflow开发者调查报告显示，超过70%的受访者使用VS Code。<sup>[5](https://monovm.com/blog/best-text-editors/)</sup>

**启动与内存。** 一份2026年的对比表报告了大致的启动时间和空闲内存：nano约0.1秒和5 MB，Vim约0.2秒和12 MB，Neovim约0.3秒和20 MB，Helix约0.3秒和25 MB，Sublime约0.4秒和80 MB，Zed约0.6秒和150 MB，VS Code约2.5秒和380 MB；打开一个250 MB文件在nano中耗时12秒，Vim和Neovim中4秒，Helix、Sublime和Zed中3秒，VS Code中7秒并伴有警告。<sup>[5](https://monovm.com/blog/best-text-editors/)</sup> 一项独立上手测试给出了不同的VS Code数据：在全新配置下冷启动5.5至6秒，空闲内存约1.5 GB，加载200 MB日志文件需7.7秒，内存攀升至1.7 GB。在同一测试中，Vim和Helix启动均约0.17秒，打开200 MB日志不到一秒，打开后内存分别为Vim 240 MB和Helix 371 MB；Sublime Text冷启动约1.38秒，但加载日志耗时近9秒，之后使用644 MB内存。<sup>[6](https://www.makeuseof.com/ranked-fastest-code-editors-quickest-isnt-talking/)</sup> VS Code启动和空闲内存的已发表数据差异很大，且该差异尚未解决；方法和配置很可能不同。

**大文件内存。** 在一项大文件内存基准测试中，Koi在100万行时使用207.6 MB，2000万行时使用2.32 GB；Vim在100万行时使用39.8 MB，500万行时使用170.2 MB；VS Code在100万行时使用258.1 MB，500万行时使用928.5 MB。Zed的内存在100万行时达到1.63 GB，500万行时达到9.03 GB，在两个规模上都超过VS Code，而Sublime Text在100万行时使用259.6 MB，500万行时使用1.10 GB。<sup>[19](https://koieditor.com/benchmarks/)</sup> EmEditor的一份厂商速度对比测试了EmEditor Professional v22.5.2、Emacs v29.1.2、[Notepad++](https://www.edgepedia.org/zh/notepad) v8.5.5、Sublime Text 4 Build 4152和UltraEdit v2023.0.0.50，在[Windows 11](https://www.edgepedia.org/zh/windows-11)系统上运行，配置为Core i9-11900K、64 GB内存和2 TB固态硬盘，均使用默认选项。<sup>[20](https://download.emeditor.com/doc/text-editor-speed-comparison.pdf)</sup>

**生态系统规模。** Zed在1.0版本发布时约有1,000个扩展，而VS Code市场有超过100,000个。<sup>[21](https://www.theregister.com/software/2026/04/30/zed-team-releases-version-10-of-rust-built-editor/5225716)</sup>

## 编辑器、IDE与LSP桥梁

实际边界在于工具链。IDE通常集成编译和调试工具；代码编辑器打开和修改文件，并可能依赖扩展来完成构建和评估；文本编辑器可以扩展出IDE的行为。<sup>[11](https://www.tiny.cloud/blog/text-editor-vs-ide-vs-code-editor/)</sup> 语言服务器协议弥合了其中大部分差距。LSP消息使用编码为UTF-8的JSON-RPC 2.0（UTF-8是目前唯一支持的字符集），协议的生命周期由客户端管理，例如VS Code或Emacs，由客户端决定何时启动和关闭服务器进程。<sup>[8](https://github.com/microsoft/language-server-protocol/blob/gh-pages/_specifications/lsp/3.18/specification.md)</sup> 客户端对textDocument/didOpen、didChange和didClose通知的支持是强制性的，客户端不能选择退出。<sup>[8](https://github.com/microsoft/language-server-protocol/blob/gh-pages/_specifications/lsp/3.18/specification.md)</sup> LSP支持被描述为对许多开发者很重要：兼容的客户端和语言服务器可以为支持的语言提供自动补全、跳转到定义、悬停文档和错误高亮等功能。<sup>[5](https://monovm.com/blog/best-text-editors/)</sup> Helix以单一二进制文件的形式内置了LSP和tree-sitter，开箱即用无需配置，不过截至评测时它没有调试器。<sup>[5](https://monovm.com/blog/best-text-editors/)</sup>

## 近期发展

**整合与新进入者。** Atom是GitHub于2014年推出的开源编辑器，于2022年12月被GitHub正式归档，终止了更新、安全补丁和新功能。<sup>[5](https://monovm.com/blog/best-text-editors/)</sup> Zed经过五年跨Mac、Windows和Linux的开发，代码超过一百万行，达到了1.0版本。<sup>[9](https://zed.dev/blog/zed-1-0)</sup> Zed 1.0于2026年4月发布，支持macOS、Windows和Linux，内置C、C++、CSS、JavaScript、TypeScript、Markdown和Python的LSP，并可选使用Zed的Zeta大语言模型提供AI编辑预测。<sup>[21](https://www.theregister.com/software/2026/04/30/zed-team-releases-version-10-of-rust-built-editor/5225716)</sup> 它用Rust编写，配有名为GPUI的定制GPU加速UI框架。<sup>[21](https://www.theregister.com/software/2026/04/30/zed-team-releases-version-10-of-rust-built-editor/5225716)</sup>

**缓冲区中的AI。** Zed 1.0支持多个并行AI代理和击键粒度的编辑预测，代理客户端协议使其向包括Claude Agent、Codex、OpenCode以及最近加入的Cursor在内的代理开放。<sup>[9](https://zed.dev/blog/zed-1-0)</sup> 允许多个代理同时工作的并行代理功能于2026年4月早些时候加入。<sup>[21](https://www.theregister.com/software/2026/04/30/zed-team-releases-version-10-of-rust-built-editor/5225716)</sup>

**商业模式。** Zed的整个代码编辑器在GPL第3版下开源，用Rust从零构建，直至手工编写的GPU着色器和操作系统图形API调用。<sup>[22](https://zed.dev/blog/fastest-ai-code-editor?e=60)</sup> [The Register](https://www.edgepedia.org/zh/the-register)将GPUI及其余代码描述为在Apache 2许可证下开源；关于Zed许可的两种说法存在差异。<sup>[21](https://www.theregister.com/software/2026/04/30/zed-team-releases-version-10-of-rust-built-editor/5225716)</sup> Zed的免费计划每月提供50次AI提示，Pro计划每月20美元提供500次提示，而编辑器在没有AI功能和不注册的情况下也能完全使用。<sup>[22](https://zed.dev/blog/fastest-ai-code-editor?e=60)</sup>

## 选择和使用编辑器

实用标准可以区分各类工具。对于原始速度和低资源占用，终端编辑器占主导：nano约0.1秒和5 MB，Vim约0.2秒和12 MB，Helix约0.3秒和25 MB。<sup>[5](https://monovm.com/blog/best-text-editors/)</sup> 对于生态系统和无需完整IDE的类IDE功能，VS Code超过70%的份额和10万扩展的市场反映了其地位。<sup>[5](https://monovm.com/blog/best-text-editors/)</sup><sup> • </sup><sup>[21](https://www.theregister.com/software/2026/04/30/zed-team-releases-version-10-of-rust-built-editor/5225716)</sup> 对于深度定制，Emacs内嵌了完整的编程语言用于编辑器功能。<sup>[14](http://www.catb.org/%7Eesr/writings/taoup/html/ch13s02.html)</sup> 对于无需配置的模态编辑，Helix将Vim和Kakoune的理念与内置LSP和tree-sitter结合在单一二进制文件中。<sup>[5](https://monovm.com/blog/best-text-editors/)</sup>

## 编辑器设计的开放边缘

传统文本编辑器从命令行字处理器演变而来，使用打字机和纸张的类比；Textoshop是一篇CHI 2025论文，探索受图形绘图软件启发的交互如何为写作开辟新的可能性。<sup>[23](https://dlnext.acm.org/doi/10.1145/3706598.3713862)</sup> 缓冲区模型本身正面临两个方向的压力：以击键粒度提出编辑并在编辑器内并行运行的AI代理，<sup>[9](https://zed.dev/blog/zed-1-0)</sup> 以及完全放弃线性打字机类比的全新交互模型。<sup>[23](https://dlnext.acm.org/doi/10.1145/3706598.3713862)</sup> 用户如何在各种编辑方法之间做出选择本身是可测量的：一项信息处理分析发现，几条简单规则能在约80%的情况下预测用户在备选编辑方法之间的选择。<sup>[24](https://www.sciencedirect.com/science/article/abs/pii/0010028580900031)</sup>

## References

1. [Online Text Editor vs Word Processor: 2026 Guide](https://notepadonlinefree.com/blog/online-text-editor-vs-word-processor)
2. [On the design of text editors (arXiv survey)](https://ar5iv.labs.arxiv.org/html/2008.06030)
3. [QED: An Online Editor (original paper)](http://bwl-website.s3-website.us-east-2.amazonaws.com/04-OnlineEditor/04-OnlineEditor.pdf)
4. [Editing Software: A Deep Dive (johal.in)](https://johal.in/editing-software-process-that-brought-deep-dive)
5. [Best Text Editors 2026: Ranked for Devs, Writers & Sysadmins (MonoVM)](https://monovm.com/blog/best-text-editors/)
6. [I ranked the fastest code editors worth using (MakeUseOf)](https://www.makeuseof.com/ranked-fastest-code-editors-quickest-isnt-talking/)
7. [VS Code TextModel source (textModel.ts)](https://github.com/microsoft/vscode/blob/master/src/vs/editor/common/model/textModel.ts)
8. [Language Server Protocol Specification 3.18](https://github.com/microsoft/language-server-protocol/blob/gh-pages/_specifications/lsp/3.18/specification.md)
9. [Zed is 1.0 (Zed blog)](https://zed.dev/blog/zed-1-0)
10. [IDEs vs. Code Editors: Everything You Need to Know (JetBrains)](https://blog.jetbrains.com/webstorm/2024/03/ides-vs-code-editors/)
11. [Difference between text editor and IDE and code editor (TinyMCE)](https://www.tiny.cloud/blog/text-editor-vs-ide-vs-code-editor/)
12. [History of QED (Dennis Ritchie, Bell Labs)](https://www.bell-labs.com/usr/dmr/www/qed.html)
13. [A personal history of modeless text editing and cut/copy-paste (ACM)](https://dl.acm.org/doi/10.1145/2212877.2212896)
14. [A Tale of Five Editors (The Art of Unix Programming)](http://www.catb.org/%7Eesr/writings/taoup/html/ch13s02.html)
15. [XEmacs Lisp Reference Manual: Buffers](https://www.xemacs.org/Documentation/21.5/html/lispref_38.html)
16. [XEmacs Internals Manual: Buffers](https://www.xemacs.org/Documentation/21.5/html/internals_24.html)
17. [The Craft of Text Editing, Chapter 6 (Craig Finseth)](https://web.mit.edu/~yandros/doc/craft-text-editing/Chapter-6.html)
18. [A comparative study of moded and modeless text editing by experienced editor users](https://doi.org/10.1145/800045.801603)
19. [Benchmarks (Koi Editor)](https://koieditor.com/benchmarks/)
20. [Text Editor Speed Comparison (EmEditor)](https://download.emeditor.com/doc/text-editor-speed-comparison.pdf)
21. [Zed team releases version 1.0 of Rust-built editor (The Register)](https://www.theregister.com/software/2026/04/30/zed-team-releases-version-10-of-rust-built-editor/5225716)
22. [Zed: The Fastest AI Code Editor (Zed blog)](https://zed.dev/blog/fastest-ai-code-editor?e=60)
23. [Textoshop: Interactions Inspired by Drawing Software to Facilitate Text Editing (CHI 2025)](https://dlnext.acm.org/doi/10.1145/3706598.3713862)
24. [Computer text-editing: An information-processing analysis of a routine cognitive skill](https://www.sciencedirect.com/science/article/abs/pii/0010028580900031)

---
*Initially written Sep 17, 2026 · Reviewed: Oct 15, 2026 · Edited: Oct 15, 2026; Oct 25, 2026 · Last review: Oct 15, 2026*

Topic: 技术与人造世界 › 计算技术与数字系统 › 软件与编程 › Application software by domain › Web browsers, clients, and user agents

Copyright 2026 Edgepedia

License: Edgepedia Community License 1.0, https://www.edgepedia.org/edgepedia/license

Source: https://www.edgepedia.org/zh/text-editor

English original: https://www.edgepedia.org/text-editor
