Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/thesems/nimbus-text-editor

Terminal-based text editor written in Rust.
https://github.com/thesems/nimbus-text-editor

piece-table rust terminal-based text-editor vim

Last synced: 24 days ago
JSON representation

Terminal-based text editor written in Rust.

Awesome Lists containing this project

README

        

# Nimbus Text Editor

Nimbus is a terminal-based text editor. It is written in rust and supports basic functionality for writing text or code.
It is also a personal study project of mine, meant to sate my curiosity of few topics (terminal API, text data structures, highlighting and vim motions).

**Features**
- Text editing
- Incremental Search
- Syntax highlighting
- Some vim motions

Supported file types for highlighting:
- Rust
- toml

## Documentation

**Keybinds**

| Keybind | Description |
|-------------- | -------------- |
| Ctrl-w | Write changes to file. |
| Ctrl-q | Quit. |
| I | Enter input mode. |
| Esc | Exit input mode. |
| : | Enter command input. |
| Arrows | Vertical/Horizontal Navigation |
| h,j,k,l | Vertical/Horizontal Navigation |
| w,b | Move forward/backward by one word. |
| Backspace | Delete a character before cursor. |
| Delete | Delete a character after cursor. |
| Home | Go to start of line. |
| End | Go to end of line. |
| 0 | Go to start of line. |
| $ | Go to end of line. |
| A | Go to end of line and change to INSERT mode.|

**Commands**

| Command | Description |
|-------------- | -------------- |
| w | Same as Ctrl-w |
| q | Same as Ctrl-q |
| / | Search a string |
| debug | Toggle debug bar |
| help | Show help text. |

**Vim motions**

Currently supported motion structure:
- {motion}
- {count}{motion}

## Implementation

**Text Buffer - Piece Table Data Structure**

The text buffer is implemented with a piece table data structure.
It allows fast insertion and deletion times.
It also does not require much meta-data per line to be stored.

**Syntax Highlighting**

A tokenizer is used to parse the text and extract syntactical structure
of the code. Based on the token type, the appropriate color is applied.
It requires each language to have it's tokenizer implemented.

## References:
[Termion - Rust terminal library](https://docs.rs/termion/latest/termion/)
[Vim motions](https://vimdoc.sourceforge.net/htmldoc/motion.html)
[Piece Table wikipedia](https://en.wikipedia.org/wiki/Piece_table)
[Simple Explanation of Piece Table](https://darrenburns.net/posts/piece-table/)
[Piece table implementation in JavaScript](https://github.com/sparkeditor/piece-table)