This started as a project for UConn's CSE 3150 course with Professor Yufeng Wu. The task was to design and implement a text editor that replicated Vim's functionality somewhat simplistically. Now, I just add stuff to it periodically because it's fun. Unfortunately, it will never outpace the real thing, or VSCode, or really any other text editor. Fun project, though!
-
Navigate to the
TextViewImpCode/directory:cd TextViewImpCode/ -
Build the editor:
make
-
The executable
myeditorwill be created in the same directory.
Run without arguments to start the editor with an empty document:
./myeditorThis will show "Press ctrl-q to quit" and you can start typing immediately. Press Ctrl+Q to quit.
Open an existing file or create a new one:
./myeditor filename.txtThe editor has two modes, similar to Vim:
- Navigation: Use arrow keys to move the cursor
- Switch to Edit Mode: Press
ito enter insert mode - Quit: Press
qto quit immediately, orCtrl+Qto quit and save
- Insert Text: Type normally to insert characters at cursor position
- New Line: Press
Enterto create a new line - Backspace: Press
Backspaceto delete characters - Exit Edit Mode: Press
Escapeto return to command mode
- Undo:
Ctrl+Z(works in both modes) - Redo:
Ctrl+Y(works in both modes)
| Key | Action |
|---|---|
Arrow Keys |
Navigate cursor |
i |
Enter edit/insert mode |
Escape |
Enter command mode |
q |
Quit immediately (command mode) |
Enter |
New line (edit mode) |
Backspace |
Delete character |
Ctrl+Q |
Quit and save |
Ctrl+Z |
Undo |
Ctrl+Y |
Redo |
-
Start the editor:
./myeditor myfile.txt
-
Press
ito enter edit mode -
Type some text:
Hello, World! This is my text editor. -
Press
Escapeto return to command mode -
Use arrow keys to navigate
-
Press
Ctrl+Qto save and quit
The file will be automatically saved when you quit the editor.