Skip to content

thesems/nimbus-text-editor

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

41 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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
Vim motions
Piece Table wikipedia
Simple Explanation of Piece Table
Piece table implementation in JavaScript