Skip to content

sardormirk/TermText

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Contributors Forks Issues


TermText - A pure C minimalistic Terminal text-editor with ~1.2K LOC

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
  1. About The Project
  2. Getting Started
  3. Usage
  4. Roadmap
  5. Contributing
  6. Acknowledgments

About The Project

Showcase

Key Features
  1. Vim-like Features: Efficient keyboard movements and commands for streamlined editing.
  2. Enhance code readability with syntax highlighting.
  3. Text Editing: Core functionality for manipulating and modifying text.
  4. WIP Config System: Work-in-progress configuration system for customization.

(back to top)

Built With

  • C++
  • Make

(back to top)

Getting Started

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.

Prerequisites

  • Cmake MacOS/Linux
    brew install cmake
    sudo apt-get install cmake

Installation

  1. Clone the repo
    git clone https://github.com/voidblob/TermText.git
  2. 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
On Windows
  1. Download a linux distribution using WSL

(back to top)

Usage

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

  1. 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
  1. 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

(back to top)

Roadmap

  • 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).

(back to top)

Contributing

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!

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

(back to top)

About

A lightweight and minimalistic terminal-based text editor written in barebones C

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published