Kilo:一个不到1000行代码的文本编辑器,支持语法高亮和搜索功能。
Kilo: A text editor in less than 1000 LOC with syntax highlight and search

原始链接: https://github.com/antirez/kilo

Kilo是一个不到1K行代码(cloc统计)的小型文本编辑器。 这里有一个屏幕录像:https://asciinema.org/a/90r2i9bq8po03nazhqtsifksb 使用方法:kilo <文件名> 按键:CTRL-S: 保存 CTRL-Q: 退出 CTRL-F: 在文件中查找字符串(ESC退出搜索,方向键导航) Kilo不依赖任何库(甚至不依赖curses)。它使用相当标准的VT100(以及类似终端)转义序列。该项目处于alpha阶段,只用了几个小时,代码取自我的另外两个项目load81和linenoise。鼓励大家将其作为起点,编写比通常的REPL风格CLI更高级的其它编辑器或命令行界面。Kilo由Salvatore Sanfilippo(又名antirez)编写,并遵循BSD 2条款许可证发布。

Hacker News 的一个帖子讨论了 “Kilo”——一个用不到 1000 行 C 代码编写的文本编辑器,具有语法高亮和搜索功能。用户们分享了他们的使用体验和相关的项目。一位用户提到,受到 Kilo 的启发,他创建了自己的基于像素的编辑器 “text2.love”,以此对抗终端的局限性。几位评论者推荐了一个教程,该教程指导用户从零开始构建类似的编辑器,并称赞其清晰易懂和教育意义。一个名为 “Kibi” 的 Rust 实现也链接其中,并承认正确处理 Unicode 的复杂性。一位用户描述了学习 Kilo 代码作为一次富有见地的学习体验,强调了它即使简单,也能教授 C 语言基础、文本编辑器和终端代码等基本概念。最后一条评论开玩笑地指出了 “Kilo”(意为千克,暗示重量)这个名字对于这样一个轻量级编辑器来说具有讽刺意味。

原文

Kilo is a small text editor in less than 1K lines of code (counted with cloc).

A screencast is available here: https://asciinema.org/a/90r2i9bq8po03nazhqtsifksb

Usage: kilo <filename>

Keys:

CTRL-S: Save
CTRL-Q: Quit
CTRL-F: Find string in file (ESC to exit search, arrows to navigate)

Kilo does not depend on any library (not even curses). It uses fairly standard VT100 (and similar terminals) escape sequences. The project is in alpha stage and was written in just a few hours taking code from my other two projects, load81 and linenoise.

People are encouraged to use it as a starting point to write other editors or command line interfaces that are more advanced than the usual REPL style CLI.

Kilo was written by Salvatore Sanfilippo aka antirez and is released under the BSD 2 clause license.

联系我们 contact @ memedata.com