All Projects → bediger4000 → Kilo In Go

bediger4000 / Kilo In Go

Kilo text editor, from Build Your Own Text Editor, in Go

Programming Languages

go
31211 projects - #10 most used programming language
golang
3204 projects

Projects that are alternatives of or similar to Kilo In Go

Novelwriter
novelWriter is an open source markdown-like plain text editor designed for writing and organising novels. Written with Python 3 (3.6+) and Qt 5 (5.3+) for cross-platform deployment.
Stars: ✭ 739 (+1219.64%)
Mutual labels:  text-editor
Edinote
Note taking web application for self-hosting. Offers tagging & Markdown support; can be used as a simple alternative to Evernote.
Stars: ✭ 17 (-69.64%)
Mutual labels:  text-editor
Bric
bric is a text editor based on kilo.
Stars: ✭ 34 (-39.29%)
Mutual labels:  text-editor
Vue Quill Editor
🍡@quilljs editor component for @vuejs
Stars: ✭ 6,874 (+12175%)
Mutual labels:  text-editor
React Lz Editor
A multilingual react rich-text editor component includes media support such as texts, images, videos, audios, links etc. Development based on Draft-Js and Ant-design, good support html, markdown, draft-raw mode. 一款基于 draft-Js 和 ant-design 实现的 react 富文本编辑器组件,支持文本、图片、视频、音频、链接等元素插入,同时支持HTML、markdown、draft Raw格式。
Stars: ✭ 894 (+1496.43%)
Mutual labels:  text-editor
Kakoune
mawww's experiment for a better code editor
Stars: ✭ 7,593 (+13458.93%)
Mutual labels:  text-editor
Angular Froala Wysiwyg
Angular 4, 5, 6, 7, 8 and 9 plugin for Froala WYSIWYG HTML Rich Text Editor.
Stars: ✭ 696 (+1142.86%)
Mutual labels:  text-editor
React Sane Contenteditable
React component with sane defaults to make any element contentEditable
Stars: ✭ 45 (-19.64%)
Mutual labels:  text-editor
Lem
Common Lisp editor/IDE with high expansibility
Stars: ✭ 894 (+1496.43%)
Mutual labels:  text-editor
Femto
A toy text editor with no dependencies written in Ruby
Stars: ✭ 34 (-39.29%)
Mutual labels:  text-editor
Void
terminal-based personal organizer
Stars: ✭ 831 (+1383.93%)
Mutual labels:  text-editor
Ved
1 MB text editor written in V with hardware accelerated text rendering. Compiles in <1s.
Stars: ✭ 888 (+1485.71%)
Mutual labels:  text-editor
Steam Review Editor
Easily create, format and preview your Steam reviews in real-time
Stars: ✭ 14 (-75%)
Mutual labels:  text-editor
Imguicolortextedit
Colorizing text editor for ImGui
Stars: ✭ 772 (+1278.57%)
Mutual labels:  text-editor
Remirror
ProseMirror toolkit for React 🎉
Stars: ✭ 973 (+1637.5%)
Mutual labels:  text-editor
Vim Quickui
The missing UI extensions for Vim 8.2 (and NeoVim 0.4) !! 😎
Stars: ✭ 714 (+1175%)
Mutual labels:  text-editor
Liquid
Clojure Text Editor, for editing clojure code and markdown. Written entirely in Clojure with inspiration from Emacs and Vim.
Stars: ✭ 859 (+1433.93%)
Mutual labels:  text-editor
O
🌀 Text editor suitable for writing git commit messages and editing Markdown files. Can build executables and jump to errors at the press of `ctrl-space`, for several programming languages. Can format code with `ctrl-w`. Provides general syntax highlighting, rainbow parenthesis and cut/paste portals. o is intentionally limited to VT100.
Stars: ✭ 54 (-3.57%)
Mutual labels:  text-editor
Envy
Text editing supercharger
Stars: ✭ 35 (-37.5%)
Mutual labels:  text-editor
Standardfile
Yet Another Standardfile (standardnotes server) Implementation written in Golang
Stars: ✭ 34 (-39.29%)
Mutual labels:  text-editor

kilo text editor in Golang

I did Build Your Own Text Editor only in Go instead of C. I tried to keep the spirit of kilo: a single file of source code, everything as simple as possible.

I tried to check in after completing each step, but sometimes I combined a few steps, or fixed bugs between steps.

Compare C and Go

I have some experience with C, but I'm learning Go. I'd like to use this project to compare the two languages, as well as to internalize Go.

I found the two languages comparable in terms of expressiveness. I transliterated the C code almost directly into Go. There was little difference in line count in the end:

Language  Files  Code    Comment  Blank  Total
    Go      1     797      163     86     1044
     C      1     757      152    161     1068

That's according to sloc

Where I found Go Better

Go's range operator made most iterations much simpler.

Go's standard packages had a type bytes.Buffer that replaced struct ab in the C version.

Go's built-in string type was a wash for me: C kilo assumes 1-byte characters, and since I was just transliterating, I did the same in Go. I ended up using []byte types for a great deal of the code that dealt with ASCII-Nul-terminated-strings. It might be fun to convert to Go string and []rune and see how that works out.

Go's memory management was a net positive. Not having to realloc() all the time was easier.

Slices seem to work well, if you think of them as typed pointers-to-arrays.

The "useful zero value" for new variables means a lot less initialization happens than in C, with a lot less room for error.

Where I found Go Worse

C's looser idea of what comprises true and false in looping and conditional tests lets C Kilo do some interesting things that required extra bool variables in Go.

Go's Linux system call support seemed a lot less well documented, but kilo does do a lot of semi-undocumented things to begin with. Getting and setting terminal attributes, and getting into and out of raw mode always seems a bit sketchy.

C's preprocessor macros actually would made a little clearer code in the Go func editorPrompt(): I found it harder to express "control H" in Go.

C enums worked better than Go const. This is a bit disingenous, since a more idiomatic Go text editor would have several small packages. Per-package types and constants would overcome this objection.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].