VM is a terminal-based text editor built in C++ using ncurses. Designed for the CS246E course at the University of Waterloo, it replicates core Vim functionality while implementing strict object-oriented design principles.
This project is a modal text editor that separates logic, data, and rendering using the Model-View-Controller (MVC) architecture. It is built entirely with RAII (Resource Acquisition Is Initialization), utilizing smart pointers to ensure memory safety without manual deletion.
- Modes: Full state-machine implementation of Normal, Insert, Replace, and Command modes.
- Motions & Operators: Supports standard navigation (
h/j/k/l,w,b) and editing commands (d,y,c) that operate on text ranges. - Search: Efficient pattern searching using the KMP algorithm.
- Macros: Record and replay complex command sequences using registers.
- Syntax Highlighting: Custom tokenization that supports syntax coloring and multi-line comment tracking.
- Smart History: An undo/redo system that calculates the minimal difference (Levenshtein distance) between file states.
- Typeracer Mode: A built-in game mode to test coding speed.
- Model: Manages the text buffer, clipboard history, and undo stack.
- View: Handles rendering, line wrapping, and syntax highlighting via
ncurses. - Controller: Processes user input and manages the transition between editor modes.
Only the interface of the program was provided due to academic policies. If you want more information on the full implementation contact me at d27chu@uwaterloo.ca.