A barebones C terminal text editor with almost 1200 lines of code. Written in pure C with no external libraries, it features a Vim-like feature set of keyboard movements and commands, syntax highlighting, file creation/loading, text editing, modal editing (normal mode, insert mode), and a work-in-progress config system.
Explore the docs »
View Demo
·
Report Bug
·
Request Feature
Table of Contents
- Vim-like Features: Efficient keyboard movements and commands for streamlined editing.
- Enhance code readability with syntax highlighting.
- Text Editing: Core functionality for manipulating and modifying text.
- WIP Config System: Work-in-progress configuration system for customization.
The following instructions are a general installation guide for MacOS/Linux. To install on windows, download visual studio and create a new project using this repo's code as existing files.
- Cmake
MacOS/Linux
brew install cmake sudo apt-get install cmake
- Clone the repo
git clone https://github.com/voidblob/TermText.git
- Go into the Build directory and run the following commands
cmake .. make ./TermText #no file name creates a new file ./TermText #file_name - opens existing file
- Download a linux distribution using WSL
To use the text editor, simply call ./TermText from the build directory along with a file name or leave it blank to create a new file
- Adding syntax highlighting for other languages:
char *C_HL_extensions[] = {".c", ".h", ".cpp", NULL}; //Add file extensions (.js for javascript, etc)
char *C_HL_keywords[] = { //Add keywords for the language you want to highlight, adding a | makes it a secondary keyword (different colour)
"#include",
"switch",
"if", "while", "for", "break", "continue", "return", "else",
"struct", "union", "typedef", "static", "enum", "class", "case",
"int|", "long|", "double|", "float|", "char|", "unsigned|", "signed|",
"void|", NULL};
struct editorSyntax HLDB[] = {
{"c", C_HL_extensions, C_HL_keywords, "//", "/*", "*/", HL_HIGHLIGHT_NUMBERS | HL_HIGHLIGHT_STRINGS},
}; //Create a editorSyntax struct, passing in the filetype, extensions array, keywords array, comment structure (C usings // and /* for comments), and highlight flags
- Commands:
- END: goes to end of line
- HOME: goes to beginning of line
- PG_DOWN: goes to end of file
- PG_UP: goes to beginning of file
- Arrow keys: movement
- HJKL: movement
- DD: deletes a line
- CTRL_S: saves file
- CTRL_Q: quits file
- ESC: enters normal mode
- i: enters insert mode
- Finish config system
- Add more colour options for different keywords
- Add a file loading system for the file extension arrays and keyword database
See the open issues for a full list of proposed features (and known issues).
Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.
If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement". Don't forget to give the project a star! Thanks again!
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature
) - Commit your Changes (
git commit -m 'Add some AmazingFeature'
) - Push to the Branch (
git push origin feature/AmazingFeature
) - Open a Pull Request