Build Your Own Text Editor in Modern C++

Introduction

Welcome to kilo++, a Modern C++ implementation inspired by antirez’s kilo. This tutorial guides you through building a fully-functional text editor that includes syntax highlighting, search functionality, and other essential features while showcasing modern C++ practices.

Note:

This tutorial has been created by GenAI. So if you find something wrong, please make a github issue to report it.

Key Features

  • Text editing fundamentals
  • Cursor movement
  • File I/O
  • Search functionality
  • Syntax highlighting
  • Status bar and messaging

Modern C++ Improvements

  • C++17 features
  • RAII resource management
  • Type-safe enums
  • Standard library containers and algorithms
  • Object-oriented design
  • Smart pointers
  • Robust string handling
  • CMake build system

Prerequisites

  • C++17 compliant compiler (g++ 9.4.0+)
  • CMake 3.16.3+
  • Basic C++ knowledge
  • Unix-like environment

Tutorial Structure

Each chapter adds incremental functionality with executable code at most steps.

Contents

  1. Setup
  2. Basic Structure
  3. Raw Input and Output
  4. Text Viewer
  5. Text Editor
  6. Search
  7. Syntax Highlighting

Ready to begin? Head to Chapter 1!