GoKilo is an attempt to port Antirez's kilo text editor from C to Go Langugae. To build this, I have followed this wonderful tutorial originally in C language that breaks down Kilo editor's development into a series of small steps. At present in GoKilo, chapters 1 through 6 of the tutorial are complete and we have a fully functional basic text edtor.
GoKilo has been substantially re-written to a much more idiomatic Go style from the original version that closely mirrored C while retaining much of the logic. However, two substantial changes were made during the rewrite:
- A small State Machine added to generalize handling of state changes between editing, save prompt for new files, quit prompt in case of unsaved changes and find interaction vs. using embedded screen & keyboard logic
- A line editor derived from the full Editor used to handle user prompts vs. custom key-handling in find function in the original
- I am starting development of a tutorial to build a simpler version of GoKilo at github.com/gokilo modeled on the original one
- Search functionality has been made case-insensitive by default and works slightly differently
- Native Windows console support - you can use GoKilo in PowerShell or Cmd
-
Porting over tutorial to Go: I plan to then re-write and release the tutorial to work with Go version of kilo. Given how close Go is to C, it should largely port over in sequence but will probalby be simpler with fewer steps due to garbage collection and type safety in Go
-
Syntax Highlighting: I haven't yet decided whether to add syntax highlighting to GoKilo
I'm using gokilo
as my default git editor.
go get github.com/srinathh/gokilo
go build