VimEngine

Portable, modular mini-vim modal editing engine component for Go terminal user interfaces (TUIs).

Overview

VimEngine is a portable, modular modal editing engine designed to bring Vim navigation and operations to any Go text input or TUI component.

Rather than implementing complex key dispatch loops repeatedly, vimengine isolates modal states (NORMAL, INSERT, VISUAL, VISUAL_LINE), register buffers, motions (w, b, 0, $, f, t, ciw, dd), and undo/redo stacks into a clean, testable Go package.


Features

  • Modal Architecture: Standard Normal, Insert, Visual, Visual-Line, and Command-Line modes.
  • Composable Editor Interface: Decoupled from specific rendering frameworks. Plug into Bubble Tea, tview, termbox, or custom AppKit/Swift bindings.
  • Vim Grammar Compliance: Supports counts (3dw, 5j), operator-pending motions (d2w, y$), and text objects (ci", da(, diw).
  • Undo / Redo Stack: Transactional multi-level history.
  • Zero External Dependencies: Built with pure standard library Go.

Installation

Add VimEngine to your Go module:

zsh — go get
$ go get github.com/msjurset/vimengine

Integration Example

package main

import (
    "github.com/msjurset/vimengine"
)

type MyWidget struct {
    engine *vimengine.Engine
    text   string
}

func NewWidget() *MyWidget {
    w := &MyWidget{text: "Hello World"}
    w.engine = vimengine.New(w)
    return w
}