# Discovered a new text editor: micro - modern, small, written in Golang (2024-03-03)

**URL:** <https://pluralist.net/t/discovered-a-new-text-editor-micro-modern-small-written-in-golang-2024-03-03/96>\
**Category:** Code Reading\
**Created:** [March 3, 2024, 8:00am UTC](https://pluralist.net/t/discovered-a-new-text-editor-micro-modern-small-written-in-golang-2024-03-03/96 "2024-03-03T08:00:00Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![delyan](https://pluralist.net/user_avatar/pluralist.net/delyan/32/245_2.png) [@delyan](https://pluralist.net/u/delyan)\
**Post date:** [March 3, 2024, 8:00am UTC](https://pluralist.net/t/discovered-a-new-text-editor-micro-modern-small-written-in-golang-2024-03-03/96/1 "2024-03-03T08:00:00Z")

</div>

A person introduced me to [micro](https://micro-editor.github.io/) today.

The micro text editor was created by [Zachary Yedidia](https://zyedidia.github.io/) back in 2016. Micro is designed to be accessible for those coming from [Nano](https://www.nano-editor.org/), but it is also appealing to [Vim](https://www.vim.org/) users looking for easily configurable options. Micro has sensible defaults, has full mouse support uses very familiar Ctrl-key shortcuts. The editor supports syntax highlighting and is extensible through plugins.

Online sources claim that: “The rise in its popularity can also be linked to the growing trend of developers looking for **lightweight, efficient tools that do not have the steep learning curve** of some other editors while still offering powerful features.”

- [micro’s source code](https://github.com/zyedidia/micro)

 ![image](https://pluralist.net/uploads/default/original/1X/eaa7c8c345e8c9241cb4425e9666b181a27fc729.jpeg)

The editor stores the contents of the file in a `[][]byte` buffer.  
There is the `Line` [primitive](https://github.com/zyedidia/micro/blob/c15abea64c20066fc0b4c328dfabd3e6ba3253a0/internal/buffer/line_array.go#L44-L61):

```go
// A Line contains the data in bytes as well as a highlight state, match
// and a flag for whether the highlighting needs to be updated
type Line struct {
	data []byte

	state highlight.State
	match highlight.LineMatch
	rehighlight bool
	lock sync.Mutex

	// The search states for the line, used for highlighting of search matches,
	// separately from the syntax highlighting.
	// A map is used because the line array may be shared between multiple buffers
	// (multiple instances of the same file opened in different edit panes)
	// which have distinct searches, so in the general case there are multiple
	// searches per a line, one search per a Buffer containing this line.
	search map[*Buffer]*searchState
}

```

And then the `LineArray` [collection of lines](https://github.com/zyedidia/micro/blob/c15abea64c20066fc0b4c328dfabd3e6ba3253a0/internal/buffer/line_array.go#L72C1-L78C2):

```go
// A LineArray simply stores and array of lines and makes it easy to insert
// and delete in it
type LineArray struct {
	lines []Line
	Endings FileFormat
	initsize uint64
}

```
