Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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.
- Host: GitHub
- URL: https://github.com/thesems/nimbus-text-editor
- Owner: thesems
- Created: 2024-01-15T11:09:01.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2024-03-20T09:38:17.000Z (11 months ago)
- Last Synced: 2024-03-20T10:49:22.264Z (11 months ago)
- Topics: piece-table, rust, terminal-based, text-editor, vim
- Language: Rust
- Homepage:
- Size: 92.8 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
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 motionsSupported 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)