我用C写了一个代码编辑器,现在我变了。
I wrote a code editor in C and now I'm a changed man

原始链接: https://github.com/thisismars-x/light

## light/HolyC:一个简单的、基于C的编辑器 light/HolyC是一个轻量级的文本编辑器,用C语言编写,优先考虑易用性而非原始速度——类似于Vim/Neovim之于Rust。它具有最小的运行时开销,并被用作Orthodox编译器项目的主要编辑器。 与Vim不同,light/HolyC主要在单个“插入”模式下运行。其功能通过**插件**(在每次输入时改变显示缓冲区的函数)和**快捷键**(Ctrl+字符组合,修改缓冲区)来扩展。 插件处理诸如行号和语法高亮显示等功能,而快捷键提供快速操作,例如添加/删除行(Ctrl+L/D)、导航到行首/行尾(Ctrl+B/E)以及跳转到特定行(Ctrl+W/A)。 该设计强调代码和使用的简洁性,旨在提供一个直接且可扩展的编辑体验。这是一个充满信念并向Terry Davis致敬的项目。

一位Hacker News用户分享了他在GitHub上的C语言代码编辑器链接,并表示这个项目是一次变革性的经历。随后的讨论很快转向了Terry Davis,他是特立独行的操作系统TempleOS的创造者。 评论者们提到了Davis的天赋以及他与精神分裂症的斗争,并表达了对TempleOS的不同看法——一些人称其为杰作,另一些人则认为其宗教内容有时令人不安。最初帖子中提到的项目似乎是对Davis的致敬,融入了相似的宗教主题。 一位评论者戏谑地责备了原作者,认为编写C语言编辑器本身并不具有改变人生的意义,从而引发了一场轻松的交流。这个帖子突显了Terry Davis复杂的遗产,以及天才、精神疾病和软件创作之间的交集。
相关文章

原文
light ' HolyCode 

[.] Praise God
[.] If Vim/Neovim is Rust, light/HolyC is C.
[.] Designed to get work done, convenient first, speed second.
[.] You can look at the holy-code(light.HolyCode.c) distributed with
this repository, to learn about the axioms of light ' HolyCode.
[.] There is almost no runtime overhead for the editor
[.] Praise God

---
light works: Orthodox, a compiler under ~10_000 loc written
in light as the primary code editor at github.com/thisismars-x/Orthodox.
---
Things you might need to know

light buffers code, and displays it, and reads for input at the
console asynchronously. The main controls are intuitive enough for
the new user. Up, down, left, right do what you expect them to
mostly. The Vim/Neovim user, might be surprised, there are no
modes in light ' holyC(or you may say, everything happens in INSERT mode).

But light ' HolyCode supports plugins, and shortcuts.
--> plugins are anything that change the DISPLAY_BUFFER[][], which is the 
main buffer maintained to capture input/user code, and are of
the form:

plugin_example_do_this(char* result, char* buffer, int i);
-> although a plugin may decide to ignore any such argument

where: result = the string that is to be altered based on buffer
	which is the current string (DISPLAY_BUFFER[CURRENT_ROW])
	         i = CURRENT_ROW_NUMBER

plugins are called everytime input is read at the console
For example, 
.	line numbers are displayed using a plugin, like so:
.	plugin_line_number(...);
.	text highlighting is also a normal plugin, like so:
.  plugin_highlight(...);

--> shortcuts are anything that change attributes of the DISPLAY_BUFFER
based on user-input, and are of the form:

shortcut_some_do_this(char ch);
-> shortcuts are always initiated with Ctrl character

shortcuts, unlike plugins are called when their Ctrl + <Char> 
tuple is received
For example,
.   Ctrl + l adds a line below your current ROW no matter your
position within that ROW unlike the normal Enter key
.   shortcut_add_line_below(...);
.   Ctrl + D removes the current line
.   shortcut_delete_curr_line(..);
.   Ctrl + X clears the current line
.   shortcut_clear_curr_line(..);
.   Ctrl + E goes to End Of Line
.   shortcut_goto_end_ROW(..);
.   Ctrl + B goes to beginning of line
.   shortcut_goto_beginning(..);
.   Ctrl + W goes to line number 0
.   shortcut_goto_line0(..);
.   Ctrl + A goes to last line
.   shortcut_goto_last_line(..);

Adding shortcuts, and plugins, is simple
God loves simple things heartfully.


RIP Terry Davis
Praise God,
Amen
联系我们 contact @ memedata.com