Kyle Isom ba9bd4a27d
Some checks failed
Release / Bump Homebrew formula (push) Has been cancelled
Bump version.
2025-11-30 17:22:54 -08:00
2025-11-30 03:21:46 -08:00
2025-11-29 16:57:01 -08:00
2025-11-29 16:57:01 -08:00
2025-11-29 16:57:01 -08:00
2025-11-30 17:22:54 -08:00
2025-11-30 16:07:30 -08:00
2025-11-30 16:07:30 -08:00
2025-11-30 16:07:30 -08:00
2025-11-30 04:34:15 -08:00
2025-11-30 04:46:10 -08:00
2025-11-30 16:07:30 -08:00
2025-11-29 20:22:24 -08:00
2025-11-29 20:22:24 -08:00
2025-11-29 20:22:24 -08:00
2025-11-29 20:22:24 -08:00
2025-11-29 21:33:45 -08:00
2025-11-29 20:22:24 -08:00
2025-11-29 20:22:24 -08:00
2025-11-29 21:33:45 -08:00
2025-11-29 20:22:24 -08:00
2025-11-29 16:57:01 -08:00
2025-11-30 01:49:38 -08:00
2025-11-29 20:22:24 -08:00
2025-11-29 20:22:24 -08:00
2025-11-29 21:33:45 -08:00

kte — Kyle's Text Editor

Vision

kte will be a small, fast, and understandable text editor with a terminalâfirst UX and an optional ImGui GUI. It modernizes the original ke editor while preserving its familiar WordStar/VDEâ€style command model and Emacsâ€influenced ergonomics. The focus is on simplicity of design, excellent latency, and pragmatic features you can learn and keep in your head.

I am experimenting with using Jetbrains Junie to assist in development, largely as a way to learn the effective use of agentic coding.

Project Goals

  • Keep the core minimal and readable; favor straightforward data structures (gap buffer, piece table) and incremental evolution.
  • Roundâ€trip editing of large files with low latency in a terminal environment.
  • Preserve ke keybindings and command semantics wherever sensible; smooth migration for ke users.
  • Provide a clean separation between core model, input, and rendering so a GUI can grow independently of the TUI.
  • Minimize dependencies; the GUI layer remains optional and isolated.

User Experience (intended)

  • Terminal first: instant startup, responsive editing, no surprises over SSH.
  • Optional GUI: an ImGuiâ€based window with tabs, menus, and palette—sharing the same editor core and command model.
  • Discoverable command model: WordStar/VDE style with a C-k prefix, Emacsâ€like incremental search, and context help.
  • Sensible defaults with a simple config file for remaps and theme selection.
  • Respect the file system: no magic project files; autosave and crashâ€recovery journals are optâ€in and visible.

Core Features (roadmapped)

  • Buffers and windows
    • Multiple file buffers; fast switching, closing, and reopening.
    • Split views (horizontal/vertical) in TUI and tiled panels in GUI.
  • Editing primitives
    • Gap buffer (primary) with an alternative piece table for largeâ€edit scenarios.
    • Kill/yank ring, word/sentence/paragraph motions, and rectangle ops.
    • Undo/redo with grouped edits and timeâ€travel scrubbing.
  • Search and replace
    • Incremental search (C-s) and regex search (C-r) with live highlighting.
    • Multiâ€file grep with a quickfix list; replace with confirm.
  • Files and projects
    • Robust encoding/lineâ€ending detection; safe writes (atomic where possible).
    • File tree sidebar (GUI) and quickâ€open palette.
    • Lightweight session restore.
  • Language niceties (optâ€in, no runtime servers required)
    • Syntax highlighting via fast, tableâ€driven lexers.
    • Basic indentation rules per language; trailing whitespace/EOF newline helpers.
  • Extensibility (later)
    • Command palette actions backed by the core command model.
    • Small C++ plugin ABI and a scripting shim for configâ€time customization.

Interfaces

  • CLI: the primary interface. kte [files] starts in the terminal, adopting your $TERM capabilities. Terminal mode is implemented using ncurses.
  • GUI: an optional ImGuiâ€based frontend that embeds the same editor core.

Architecture (intended)

  • Core model
    • Buffer: file I/O, cursor/mark, viewport state, and edit operations.
    • GapBuffer: fast inâ€memory text structure for typical edits.
    • PieceTable: alternative representation for heavy insert/delete workflows.
  • Controller layer
    • InputHandler interface with TerminalInputHandler and GUIInputHandler implementations.
    • Command: normalized operations (save, kill, yank, move, search, etc.).
  • View layer
    • Renderer interface with TerminalRenderer and GUIRenderer implementations.
  • Editor: topâ€level state managing buffers, messaging, and global flags.

Performance and Reliability Targets

  • Subâ€millisecond keystroke to screen update on typical files in TUI.
  • Sustain fluid editing on multiâ€megabyte files; graceful degradation on very large files.
  • Atomic/safe writes; autosave and crashâ€recovery journals are explicit and transparent.

Keybindings

kte maintains ke’s command model while internals evolve. Highlights (subject to refinement):

  • Kâ€command prefix: C-k enters kâ€command mode; exit with ESC or C-g.
  • Save/Exit: C-k s (save), C-k x or C-k C-x (save and exit), C-k q (quit with confirm), C-k C-q (quit immediately).
  • Editing: C-k d (kill to EOL), C-k C-d (kill line), C-k BACKSPACE (kill to BOL), C-w (kill region), C-y ( yank), C-u (universal argument).
  • Navigation/Search: C-s (incremental find), C-r (regex search), ESC f/b (word next/prev), ESC BACKSPACE (delete previous word).
  • Buffers/Files: C-k e (open), C-k b/C-k p (switch), C-k c (close), C-k C-r (reload).
  • Misc: C-l (refresh), C-g (cancel), C-k m (run make), C-k g (goto line).

See ke.md for the canonical ke reference retained for now.

Build and Run

Prerequisites: C++17 compiler, CMake, and ncurses development headers/libs.

Dependencies by platform

  • macOS (Homebrew)

    • Terminal (default):
      • brew install ncurses
    • Optional GUI (enable with -DBUILD_GUI=ON):
      • brew install sdl2 freetype
      • OpenGL is provided by the system framework on macOS; no package needed.
  • Debian/Ubuntu

    • Terminal (default):
      • sudo apt-get install -y libncurses5-dev libncursesw5-dev
    • Optional GUI (enable with -DBUILD_GUI=ON):
      • sudo apt-get install -y libsdl2-dev libfreetype6-dev mesa-common-dev
      • The mesa-common-dev package provides OpenGL headers/libs (libGL).
  • NixOS/Nix

    • Terminal (default):
      • Ad-hoc shell: nix-shell -p cmake gcc ncurses
    • Optional GUI (enable with -DBUILD_GUI=ON):
      • Ad-hoc shell: nix-shell -p cmake gcc ncurses SDL2 freetype libGL
    • With flakes/devshell (example flake.nix inputs not provided): include ncurses for TUI, and SDL2, freetype, libGL for GUI in your devShell.

Notes

  • The GUI is OFF by default to keep SDL/OpenGL/Freetype optional. Enable it by configuring with -DBUILD_GUI=ON and ensuring the GUI deps above are installed for your platform.
  • If you previously configured with GUI ON and want to disable it, reconfigure the build directory with -DBUILD_GUI=OFF.

Example build:

cmake -S . -B cmake-build-debug -DCMAKE_BUILD_TYPE=Debug
cmake --build cmake-build-debug

Run:

./cmake-build-debug/kte [files]

GUI build example

To build with the optional GUI (after installing the GUI dependencies listed above):

cmake -S . -B cmake-build-debug -DCMAKE_BUILD_TYPE=Debug -DBUILD_GUI=ON
cmake --build cmake-build-debug
./cmake-build-debug/kte --gui [files]

Status

  • The project is under active evolution toward the above architecture and UX. The terminal interface now uses ncurses for input and rendering. GUI work will follow as a thin, optional layer. ke compatibility remains a primary constraint while internals modernize.

Roadmap (high level)

  1. Solidify core buffer model (gap buffer), file I/O, and keâ€compatible commands.
  2. Introduce structured undo/redo and search/replace with highlighting.
  3. Stabilize terminal renderer and input handling across common terminals. (initial ncurses implementation landed)
  4. Add piece table as an alternative backend with runtime selection per buffer.
  5. Optional GUI frontend using ImGui; shared command palette.
  6. Language niceties (syntax highlighting, indentation rules) behind a zeroâ€deps, fast path.
  7. Session restore, autosave/journaling, and safe write guarantees.
  8. Extensibility hooks with a small, stable API. References

  • ke manual and keybinding reference: ke.md
  • Inspirations: Antirez’ kilo, WordStar/VDE, Emacs, and mg(1)
Description
No description provided
Readme 67 MiB
Languages
C++ 91.2%
C 7.9%
Objective-C++ 0.7%
CMake 0.1%